Re: MultiECLockManager. Set and forget ?
Re: MultiECLockManager. Set and forget ?
- Subject: Re: MultiECLockManager. Set and forget ?
- From: Kieran Kelleher <email@hidden>
- Date: Wed, 25 Apr 2007 22:12:20 -0400
Many ways to skin the cat here.... Your own EC subclass,
MultiECLockManager and Wonder are all not mutually exclusive. I've
been using them in combination since I first adopted WOnder because I
was using MultiECLockManager before that. The only thing you need to
do for Wonder integration is simply create a ec factory and set the
factory in App constructor. This may be of use (or not) to you.......
______________________________________________________________________
Regarding Wonder integration
Call this in your app constructor to set the default ec factory for
project wonder
<snip>
// Configure the Editing Context factory for my subclass of
ERXEC
ERXEC.setFactory( new WKEditingContextFactory() );
</snip>
______________________________________________________________________
Example of a factory for Wonder to return your own *subclass of
ERXEC* look sth like this:
<class>
package wk.cheetah;
//
// WKEditingContextFactory.java
// @author Kieran 2005.
//
import com.webobjects.eocontrol.EOEditingContext;
import com.webobjects.eocontrol.EOObjectStore;
import er.extensions.ERXEC;
/** The sole purpose of this class is so that the ERXEC factory class
creates
my subclass WKEditingContext which inherits from ERXEC instead
of ERXEC itself.
TODO : Put this in a framework. */
public class WKEditingContextFactory extends ERXEC.DefaultFactory {
public WKEditingContextFactory() {
super();
}
/** Actual EC creation bottleneck. Override this to return other
subclasses of ERXEC instead of ERXEC itself. */
protected EOEditingContext _createEditingContext(EOObjectStore
parent) {
return new WKEditingContext(parent == null ?
EOEditingContext.defaultParentObjectStore() : parent);;
}
}
</class>
________________________________________________________________________
I have a simple factory I use for creating ec's in my app. This can
be as simple as a static method in your ec subclass createInstance
( ... ) with parameters to create the various types of ec's such as
- a MultiECLockManager manager ec
- a self-managed lock/unlock ec for separate threads (not R-R threads)
- optional EOObjectsStoreCoordinator parent other than the default
HTH, Kieran
On Apr 25, 2007, at 8:12 PM, Owen McKerrow wrote:
Hi All,
Im looking at cleaning up our locking procedures on some of our
projects. Looking over past emails and on the wiki the most commons
suggestions are either MultiECLockManager or Project Wonders ERXEC.
We're not using Wonder at the moment so Im thinking
MultiECLockManager. I seem to remember Chuck once implying that it
was basically a set and forget sort of thing, that once you had
registered you EC with it you didn't need to worry about locking
anymore. Is this really the case ?
What we have on the current project is a base component that all of
our other components extend from. This base component contains a
variation of Chucks CoOperatingEditingContext (thanks Chuck), so
each of our pages has their own EC with session wide variables,
like who's currently logged in, being stored in the default editing
context.
What Im wondering is if I was to use MultiECLockManager and it is
as simple as it seems, all I should need to do is in my base
component when the EC is created, register it with the Manager and
then go back through all of my code and find any ec.lock(),
ec.unlock() and remove them.
Am I understanding this correctly ?
Owen McKerrow
WebMaster, emlab
Ph : +61 02 4221 5517
http://emlab.uow.edu.au
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
"I like the way this project has somehow, against all common sense,
got itself made."
- Peter Jackson, "The Lord of The Rings"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
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