I am making a Wonder app, and I Wonder: I still should maybe lock the ec before 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." However, the discussion here: http://lists.apple.com/archives/webobjects-dev/2005//Aug/thrd2.ht ml#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/msg0057 8.html 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 : ? 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. On Aug 13, 2009, at 11:38 AM, [email protected] wrote: Message: 7 Date: Thu, 13 Aug 2009 09:18:10 -0400 From: Mike Schrag <[email protected]> Subject: Re: ERXEC and locking To: WebObjects-Dev List <[email protected]> Message-ID: <[email protected]> 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 protected]
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
