You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by oz...@apache.org on 2005/02/11 20:46:42 UTC

svn commit: r153450 - jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.java

Author: ozeigermann
Date: Fri Feb 11 11:46:40 2005
New Revision: 153450

URL: http://svn.apache.org/viewcvs?view=rev&rev=153450
Log:
Split 

lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs)

into two parts to make subclassing easier

Modified:
    jakarta/commons/proper/transaction/trunk/src/java/org/apache/commons/transaction/locking/GenericLockManager.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&r1=153449&r2=153450
==============================================================================
--- 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 Feb 11 11:46:40 2005
@@ -190,13 +190,19 @@
      */
     public void lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility,
             boolean preferred, long timeoutMSecs) throws LockException {
+        timeoutCheck(ownerId);
+        GenericLock lock = (GenericLock) atomicGetOrCreateLock(resourceId);
+        doLock(lock, ownerId, resourceId, targetLockLevel, compatibility, preferred, timeoutMSecs);
+    }
+
+    protected void doLock(GenericLock lock, Object ownerId, Object resourceId, int targetLockLevel,
+                          int compatibility, boolean preferred, long timeoutMSecs)
+    {
         long now = System.currentTimeMillis();
         long waitEnd = now + timeoutMSecs;
 
         timeoutCheck(ownerId);
         
-        GenericLock lock = (GenericLock) atomicGetOrCreateLock(resourceId);
-
         GenericLock.LockOwner lockWaiter = new GenericLock.LockOwner(ownerId, targetLockLevel,
                 compatibility, preferred);
         



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