commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ozeigerm...@apache.org
Subject svn commit: r149016 - /jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java /jakarta/commons/proper/transaction/trunk/src/test/org/apache/commons/transaction/locking/GenericLockTest.java
Date Sat, 29 Jan 2005 06:43:21 GMT
Author: ozeigermann
Date: Fri Jan 28 22:43:19 2005
New Revision: 149016

URL: http://svn.apache.org/viewcvs?view=rev&rev=149016
Log:
Assuring timeouts are always checked against current time
Modified:
   jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java
   jakarta/commons/proper/transaction/trunk/src/test/org/apache/commons/transaction/locking/GenericLockTest.java

Modified: jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java
Url: http://svn.apache.org/viewcvs/jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java?view=diff&rev=149016&p1=jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java&r1=149015&p2=jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java&r2=149016
==============================================================================
--- jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java
(original)
+++ jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java
Fri Jan 28 22:43:19 2005
@@ -202,6 +202,7 @@
                         LockException.CODE_DEADLOCK_VICTIM, resourceId);
             }
 
+            now = System.currentTimeMillis();
             while (!acquired && waitEnd > now) {
             
                 // first be sure all locks are stolen from owners that have already timed
out

Modified: jakarta/commons/proper/transaction/trunk/src/test/org/apache/commons/transaction/locking/GenericLockTest.java
Url: http://svn.apache.org/viewcvs/jakarta/commons/proper/transaction/trunk/src/test/org/apache/commons/transaction/locking/GenericLockTest.java?view=diff&rev=149016&p1=jakarta/commons/proper/transaction/trunk/src/test/org/apache/commons/transaction/locking/GenericLockTest.java&r1=149015&p2=jakarta/commons/proper/transaction/trunk/src/test/org/apache/commons/transaction/locking/GenericLockTest.java&r2=149016
==============================================================================
--- jakarta/commons/proper/transaction/trunk/src/test/org/apache/commons/transaction/locking/GenericLockTest.java
(original)
+++ jakarta/commons/proper/transaction/trunk/src/test/org/apache/commons/transaction/locking/GenericLockTest.java
Fri Jan 28 22:43:19 2005
@@ -154,7 +154,7 @@
         
         sLogger.logInfo("\n\nChecking timeouts\n\n");
 
-        ReadWriteLockManager lockManager = new ReadWriteLockManager(sLogger, 100);
+        ReadWriteLockManager lockManager = new ReadWriteLockManager(sLogger, 1000);
         boolean timedOut = false;
         try {
             lockManager.readLock("owner1", "resource");
@@ -164,6 +164,16 @@
             timedOut = true;
         }
         assertTrue(timedOut);
+        lockManager = new ReadWriteLockManager(sLogger, 100);
+        timedOut = false;
+        try {
+            lockManager.readLock("owner1", "resource");
+            lockManager.writeLock("owner2", "resource");
+        } catch (LockException le) {
+            assertEquals(le.getCode(), LockException.CODE_TIMED_OUT);
+            timedOut = true;
+        }
+        assertTrue(timedOut);
         lockManager = new ReadWriteLockManager(sLogger, 0);
         timedOut = false;
         try {
@@ -173,6 +183,7 @@
             assertEquals(le.getCode(), LockException.CODE_TIMED_OUT);
             timedOut = true;
         }
+        assertTrue(timedOut);
     }
     
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message