On Apr 29, 2008, at 3:25 PM, Owen McKerrow wrote:

public void sleep()
        {
// Need to check as this gets called after terminate() when logging out
       synchronized (ecLockManager)
       {
           if (ecLockManager().isLocked())
           {
               ecLockManager().unlock();
           }
       }
                super.sleep();
        }

Hmm, the version of MultiECLockManager that I use doesn't implement isLocked(), so I don't know what isLocked() accomplishes. The only public methods are lock(), unlock(), registerEditingContext(), and unregisterEditingContext(), and I never send a MultiECLockManager object an unregisterEditingContext() message (it's not necessary).

Also, in the MultiECLockManager that I use, lock() and unlock() are synchronized methods, so I don't understand why you are invoking unlock() in a synchronized block.

public void terminate()
   {
// Need to make sure this is unlocked so that editing contexts nested in the defaultEditingContext
       // don't hold locks on it when it gets disposed
       synchronized (ecLockManager)
       {
           if (ecLockManager().isLocked())
           {
               ecLockManager().unlock();
           }
       }
       super.terminate();
}


The header in my version of MultiECLockManager makes no mention of sending a MultiECLockManager object an unlock() message in Session.terminate(), so I don't do this. However, if you do this and there's no matching lock() invocation, MultiECLockManager will throw an exception (maybe MultiECLockManager.isLocked() would prevent this from occurring). You're not catching this exception in terminate() and aren't invoking super.terminate() in a finally block, so if an exception is thrown, super.terminate() won't be invoked which can cause nasty problems.

Aloha,
Art

_______________________________________________
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]

Reply via email to