• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: locking problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: locking problem


  • Subject: Re: locking problem
  • From: Ben Trumbull <email@hidden>
  • Date: Sat, 18 Dec 2004 15:45:11 -0800

At 5:58 PM -0500 12/18/04, Nathan Dumar wrote:
In my app, I'm using MultiECLockManager.  I'm locking and unlocking in session
awake and asleep.  I have no direct actions.  On my dev machine, I can
ec.dispose() in a component without a problem.  On the deployment machine
disposing an EC causes the following error:

java.lang.IllegalStateException: Illegal Lock usage: unlock() called without a
lock()

I believe this is known issue in WO. The sequence of events is: 1) Session locks its EC at the beginning of the event loop 2) User code invokes dispose() on the Session's EC 3) Session unlocks its EC at the end of the event loop, which no longer exists 4) Boom

dispose() has to unlock the EC for very complicated reasons to prevent deadlocking.

Don't call dispose() on the Session's default editing context. While one would guess an issue like this would be fixed soon, it's really not good engineering style to nuke an object that belongs to someone else (i.e. the EC belongs to the session that created it)

All in all, you shouldn't need to call dispose(). When the EC is finalized by the garbage collector, the exact same thing will happen. The only difference is when. Invoking dispose() really only changes your app's memory usage characteristics (i.e. peak heap size, not average memory required).

If you find you must dispose() the EC, but get bitten by this bug, try using reset() and letting the GC do dispose().

If this isn't your session's default EC, then it's not the problem I'm describing here.

Of course, if it's your own EC, and you unlock it in sleep() after you've called dispose() then you've just recreated the problem in your own code.
--


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


  • Follow-Ups:
    • Re: locking problem
      • From: Nathan Dumar <email@hidden>
References: 
 >locking problem (From: Nathan Dumar <email@hidden>)

  • Prev by Date: locking problem
  • Next by Date: Re: locking problem
  • Previous by thread: locking problem
  • Next by thread: Re: locking problem
  • Index(es):
    • Date
    • Thread