On Jan 27, 2009, at 6:23 AM, Stamenkovic Florijan wrote:

Hi all,

I am starting to get another locking exception, shortly after switching to 5.4. Could be that the update changed something, or that I simply never managed to trigger this before (race condition). So, the exception is:

java.lang.IllegalMonitorStateException
at java.util.concurrent.locks.ReentrantLock $Sync.tryRelease(ReentrantLock.java:125) at java .util .concurrent .locks .AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java: 1137) at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java: 431) at com .webobjects .eodistribution .client .EODistributedObjectStore.unlock(EODistributedObjectStore.java:107) at com .webobjects .eocontrol.EOEditingContext.unlockObjectStore(EOEditingContext.java: 4668)
        at org.wojc.client.JCEC.unlockObjectStore(JCEC.java:280)
at com .webobjects .eocontrol.EOCustomObject.willReadRelationship(EOCustomObject.java: 1281) at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer $ _LazyGenericRecordBinding .valueInObject(_EOMutableKnownKeyDictionary.java:614) at com .webobjects .eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1634) at com.havaso.dvis.client.eof.eo._Account.debitBookings(_Account.java: 168)
...


This happens while I have two threads doing some work. One is performing calculations, the other is updating the GUI. Both of them are accessing the same EOs, asking them for data.

That sounds problematic. Usually one thread would hold the EC lock and only that thread would touch the EOs.



So, a few questions:
1. Does anyone know if ReentrantLock is only used since 5.4? I don't recall seeing WO use any java.util.concurrent stuff before...

I will give this a cautious "I think so".


2. EOCustomObject.willReadRelationship is calling "unlockObjectStore(...)" while the thread this is happening on does not actually own the lock in the EODistributedObjectStore... To me this looks like a bug outside the scope of my code. Or am I missing something?

It will lock the object store to fire a fault for the relationship. Then it will unlock it. Perhaps both threads were firing faults at the same time?


3. Ideas, suggestions (bug reporting aside)?


EOF does not really like more than one thread accessing EOs at one time. Can you use two sets of EOs in different editing contexts? Post notifications from the thread doing the calculations?


Chuck

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