Re: ERXEC and locking
Re: ERXEC and locking
- Subject: Re: ERXEC and locking
- From: Chuck Hill <email@hidden>
- Date: Wed, 19 Aug 2009 10:47:40 -0700
On Aug 19, 2009, at 9:55 AM, email@hidden wrote:
I am making a Wonder app, and I Wonder: I still should maybe lock
the ec before using it?
That depends on how you are using it. :-)
You still have to lock the EC before using it. ERXEC just prevents
leaving locked EC afters the RR loop. However, you can also set the
autoLock stuff to on
er.extensions.ERXEC.defaultAutomaticLockUnlock=true
in which case the EC will get automatically looked. As this can
lead to deadlocks I normally donĀ“t recommend it, though.
Cheers, Anjo
I was lead to believe that ERXEC was a "Subclass that has every
public method overridden to support automatic lock/unlock handling
for you."
Only if you have this enabled:
er.extensions.ERXEC.safeLocking=true
(or er.extensions.ERXEC.defaultAutomaticLockUnlock=true, but I'd stick
with safeLocking)
However, the discussion here:
http://lists.apple.com/archives/webobjects-dev/2005//Aug/thrd2.html#00164
seems to say one is better off manually locking / unlocking the ec
( with try/catch/finally blocks ), and uhuh..don't you go and rely
on that auto-locking voodoo !
An update in 2007 : http://lists.apple.com/archives/Webobjects-dev/2007/May/msg00578.html
There are a lot of messages on that page. You will have to be more
specific if you want me to read them. :-)
Is that the latest word on the subject? I know things change over
time, which is often a good thing.
Where is the truth? in the Wonder documentation? ; > o
Is it safe to summarize : ?
1. er.extensions.ERXEC.safeLocking=true
2. Profit
A Wonder application that sets the property
er.extensions.ERXEC.safeLocking=true (this is equal to setting
several properties like the above mentioned one)
will be auto-magically locked and unlocked during the R-R loop. Any
other threads not on the R-R loop (like a java.util.TimerTask)
should use manual locking with the
try{ec.lock...}catch{}finally{ec.unlock} block.
That is correct.
Chuck
On Aug 13, 2009, at 11:38 AM, email@hidden
wrote:
Message: 7
Date: Thu, 13 Aug 2009 09:18:10 -0400
From: Mike Schrag <email@hidden>
Subject: Re: ERXEC and locking
To: WebObjects-Dev List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
I have been watching Chuck's podcast - "WebObjects Quite Good
Practices", and I would like to make absolutely sure that I
understand this correctly.
Q: Is it true to say:
---------
If I use ERXEC to create all my editingContexts, using:
EOEditingContext ec = ERXEC.newEditingContext();
then I do not have to worry about locking, it all happens
automagically.
assuming you have the appropriate properties set to autolock
Are the default settings to 'autolock'?
if by "default" you mean "with no Properties files," no, the default
is normal behavior. if by "default" you mean "the default Properties
file that WOLips makes," then yes. you should look in your Propeties
file to see if you have autolocking enabled.
Also, are the ECs that I create in the middle of an RR-loop safe?
yes
ms
--
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
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
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