Re: default editing context locking in directaction
Re: default editing context locking in directaction
- Subject: Re: default editing context locking in directaction
- From: Chuck Hill <email@hidden>
- Date: Thu, 21 Jul 2005 11:45:50 -0700
Here is another way to handle this:
public WOActionResults someAction() {
WOComponent page = pageWithName("Foo");
WOResponse response;
session().defaultEditingContext().lock;
try {
...
response = page.generateResponse().
} finally {
session().defaultEditingContext().unlock;
}
return response;
}
The call to generateResponse before the unlock ensures that
appendToResponse is called while the EC is locked and that all the
faults are fired in a safe state.
Chuck
On Jul 20, 2005, at 12:28 AM, Anjo Krank wrote:
Am 20.07.2005 um 08:50 schrieb Mike Schrag:
If i call session().defaultEditingContext() from within a
DirectAction, I'm currently defensively locking it. Do I need to,
or does it follow the same (automatic) locking rules as in a
normal WOComponent?
You don't need to lock it.
But anyway, doing sth like:
public WOActionResults someAction() {
WOActionResults page = pageWithName("Foo");
session().defaultEditingContext().lock;
try {
...
} finally {
session().defaultEditingContext().unlock;
}
return page;
}
isn't sufficient, as the appendToResponse phase only occurs *after*
the page is returned and faults could still get fired there... so
when you create an EC there instead of using the session EC, you
still have to lock it in the component.
Cheers, Anjo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden