ozeigermann 2005/01/09 11:33:53
Modified: transaction/src/java/org/apache/commons/transaction/locking
GenericLockManager.java
Log:
Constantly have owner registered as waiter while trying to acquire lock
Revision Changes Path
1.19 +13 -7
jakarta-commons/transaction/src/java/org/apache/commons/transaction/locking/GenericLockManager.java
Index: GenericLockManager.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/transaction/src/java/org/apache/commons/transaction/locking/GenericLockManager.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- GenericLockManager.java 9 Jan 2005 19:10:10 -0000 1.18
+++ GenericLockManager.java 9 Jan 2005 19:33:53 -0000 1.19
@@ -218,9 +218,15 @@
} else {
timeoutMSecs = waitEnd - now;
}
-
- acquired = lock.acquire(ownerId, targetLockLevel, true,
compatibility,
- preferred, timeoutMSecs);
+
+ // XXX acquire will remove us as a waiter, but it is
important to remain us such
+ // to constantly indicate it to other owners, otherwise
there might be undetected
+ // deadlocks
+ synchronized (lock) {
+ acquired = lock.acquire(ownerId, targetLockLevel, true,
compatibility,
+ preferred, timeoutMSecs);
+ lock.registerWaiter(lockWaiter);
+ }
}
if (!acquired) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]