locking with more coordinators causes an exception?
locking with more coordinators causes an exception?
- Subject: locking with more coordinators causes an exception?
- From: OC <email@hidden>
- Date: Fri, 23 Jan 2015 15:32:35 +0100
Hello there,
in the same new log, I've bumped into another problem. My application uses
WOAllowsConcurrentRequestHandling = true
er.extensions.ERXObjectStoreCoordinatorPool.maxCoordinators=3
My saving code looks like this:
===
EOEditingContext ec=auction.editingContext()
EOObjectStore osc=ec.rootObjectStore()
osc.lock()
try {
EOEditingContext tempec=ERXEC.newEditingContext()
tempec.fetchTimestamp=System.currentTimeMillis()
def tempau=auction.localInstanceIn(tempec)
tempec.lockObject(tempau) // *
... yadda yadda yadda ...
tempec.saveChanges();
} catch (exc) {
PRINT_ERROR(exc,"Exception adding price offer FOR prc $poValue CU $sess.currentUser.login")
...
} finally {
osc.unlock()
}
===
Is the // * lock wrong? I've thought if two threads try to work with the same auction, the latter one would wait in the lock until the former saves. Looks like I was wrong: two users tried to save concurrently; they both locked their OSC's all right, but then I've got an exception
===
Caused by: java.lang.IllegalStateException: Failed to lock object:com.webobjects.eoaccess.EODatabaseContext@15e1e22b with gid:_EOIntegralKeyGlobalID[DBAuction (java.lang.Integer)1000409]
at com.webobjects.eoaccess.EODatabaseContext.lockObjectWithGlobalID(EODatabaseContext.java:3287)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.lockObjectWithGlobalID(EOObjectStoreCoordinator.java:525)
at com.webobjects.eocontrol.EOEditingContext.lockObjectWithGlobalID(EOEditingContext.java:4237)
at com.webobjects.eocontrol.EOEditingContext.lockObject(EOEditingContext.java:4461)
at er.extensions.eof.ERXEC.lockObject(ERXEC.java:1376)
at er.extensions.eof.ERXEC$lockObject$9.call(Unknown Source)
at components.sharedparts.BidsEditor$_addPriceOffer(BidsEditor.groovy:411) // this is the lockObject(tempau) // *
===
What am I doing wrong? Should I _not_ lock the objects I am working with when saving?
Thanks,
OC
_______________________________________________
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