Hi,

I've been having a problem when using exclusive access, in that once every 200 or so logins of a user, Castor would report an attempt to load the user object twice in different modes in the same transaction.

After much debugging, I believe the following code fragment from LockEngine.java line 907 onwards is to blame :

--- snip ---

typeInfo = (TypeInfo) _typeInfo.get( oid.getName() );
lock = typeInfo.release( oid, tx );
lock.getOID().setDbLock( false );

--- snip ---

Specifically the final line - the OID associated with the lock is being updated *after* the lock is released, i.e. when the current thread doesn't own it any more.

In my case thread 1 executes line two, then thread 2 gets it's timeslice, acquires the lock, loads the object from the database and marks it db locked.

Then thread 1 gets it's timeslice and executes line 3 to mark the object not db locked.

Some time later thread 2 loads this object again, it is found in the transaction context, but db locked is false, erroneously indicating that it was loaded in shared or read-only access mmode, cue exception.

Cheers

--

Keir Bowden
Olive Systems Limited
http://www.olive.co.uk

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to