ozeigermann 2004/12/19 02:54:52
Modified: transaction/src/java/org/apache/commons/transaction/locking
GenericLockManager.java
Log:
Minor
Revision Changes Path
1.8 +19 -10
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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- GenericLockManager.java 19 Dec 2004 10:10:13 -0000 1.7
+++ GenericLockManager.java 19 Dec 2004 10:54:52 -0000 1.8
@@ -100,18 +100,24 @@
this(maxLockLevel, logger, DEFAULT_TIMEOUT);
}
-
+ /**
+ * Sets a global timeout for an owner. This is especially usefull, when
the owner is a
+ * transaction. After a global timeout occurs all of the owner's lock
will be released and
+ * the owner will not be allowed to access any
+ * locks before before calling [EMAIL PROTECTED] #releaseAll(Object)}.
+ *
+ * @param ownerId
+ * a unique id identifying the entity that wants to acquire
this
+ * lock
+ * @param timeoutMSecs
+ * specifies the global timeout in milliseconds
+ */
public void setGlobalTimeout(Object ownerId, long timeoutMSecs) {
long now = System.currentTimeMillis();
long timeout = now + timeoutMSecs;
globalTimeouts.put(ownerId, new Long(timeout));
}
- public long getGlobalTimeoutTime(Object ownerId) {
- Long timeout = (Long) globalTimeouts.get(ownerId);
- return timeout.longValue();
- }
-
/**
* @see LockManager#tryLock(Object, Object, int, boolean)
*/
@@ -160,6 +166,9 @@
// is important as the other thread might be the one to discover
the deadlock
// (b) register us as a waiter before actually trying, so other
threads take us into account
+ // XXX: This may however mean both deadlocking parts detect the
deadlock simultaneously,
+ // and both will be rolled back. The (worse) alternative, however,
is that we add us
+ // as a waiter ofter deadlock check which may mean we do not detect
the deadlock at all
addWaiter(lock, ownerId);
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]