directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1378946 - /directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
Date Thu, 30 Aug 2012 14:10:55 GMT
Author: elecharny
Date: Thu Aug 30 14:10:55 2012
New Revision: 1378946

URL: http://svn.apache.org/viewvc?rev=1378946&view=rev
Log:
Made the rwLock set and unset in a separate method

Modified:
    directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java

Modified: directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1378946&r1=1378945&r2=1378946&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
(original)
+++ directory/apacheds/branches/apacheds-mvbt/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
Thu Aug 30 14:10:55 2012
@@ -94,6 +94,42 @@ public class DefaultOperationManager imp
 
 
     /**
+     * Acquires a ReadLock
+     */
+    private void lockRead()
+    {
+        rwLock.readLock().lock();
+    }
+
+
+    /**
+     * Acquires a WriteLock
+     */
+    private void lockWrite()
+    {
+        rwLock.writeLock().lock();
+    }
+
+
+    /**
+     * Releases a ReadLock
+     */
+    private void unlockRead()
+    {
+        rwLock.readLock().unlock();
+    }
+
+
+    /**
+     * Releases a WriteLock
+     */
+    private void unlockWrite()
+    {
+        rwLock.writeLock().unlock();
+    }
+
+
+    /**
      * Eagerly populates fields of operation contexts so multiple Interceptors
      * in the processing pathway can reuse this value without performing a
      * redundant lookup operation.
@@ -328,13 +364,13 @@ public class DefaultOperationManager imp
 
             try
             {
-                rwLock.writeLock().lock();
+                lockWrite();
 
                 head.add( addContext );
             }
             finally
             {
-                rwLock.writeLock().unlock();
+                unlockWrite();
             }
         }
 
@@ -357,13 +393,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.readLock().lock();
+            lockRead();
 
             head.bind( bindContext );
         }
         finally
         {
-            rwLock.readLock().unlock();
+            unlockRead();
         }
 
         LOG.debug( "<< BindOperation successful" );
@@ -442,13 +478,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.readLock().lock();
+            lockRead();
 
             result = head.compare( compareContext );
         }
         finally
         {
-            rwLock.readLock().unlock();
+            unlockRead();
         }
 
         LOG.debug( "<< CompareOperation successful" );
@@ -530,13 +566,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.writeLock().lock();
+            lockWrite();
 
             head.delete( deleteContext );
         }
         finally
         {
-            rwLock.writeLock().unlock();
+            unlockWrite();
         }
 
         LOG.debug( "<< DeleteOperation successful" );
@@ -578,13 +614,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.readLock().lock();
+            lockRead();
 
             result = head.hasEntry( hasEntryContext );
         }
         finally
         {
-            rwLock.readLock().unlock();
+            unlockRead();
         }
 
         LOG.debug( "<< HasEntryOperation successful" );
@@ -608,13 +644,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.readLock().lock();
+            lockRead();
 
             cursor = head.list( listContext );
         }
         finally
         {
-            rwLock.readLock().unlock();
+            unlockRead();
         }
 
         LOG.debug( "<< ListOperation successful" );
@@ -638,13 +674,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.readLock().lock();
+            lockRead();
 
             entry = head.lookup( lookupContext );
         }
         finally
         {
-            rwLock.readLock().unlock();
+            unlockRead();
         }
 
         LOG.debug( "<< LookupOperation successful" );
@@ -735,13 +771,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.writeLock().lock();
+            lockWrite();
 
             head.modify( modifyContext );
         }
         finally
         {
-            rwLock.writeLock().unlock();
+            lockWrite();
         }
 
         LOG.debug( "<< ModifyOperation successful" );
@@ -843,13 +879,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.writeLock().lock();
+            lockWrite();
 
             head.move( moveContext );
         }
         finally
         {
-            rwLock.writeLock().unlock();
+            unlockWrite();
         }
 
         LOG.debug( "<< MoveOperation successful" );
@@ -952,13 +988,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.writeLock().lock();
+            lockWrite();
 
             head.moveAndRename( moveAndRenameContext );
         }
         finally
         {
-            rwLock.writeLock().unlock();
+            unlockWrite();
         }
 
         LOG.debug( "<< MoveAndRenameOperation successful" );
@@ -1053,13 +1089,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.writeLock().lock();
+            lockWrite();
 
             head.rename( renameContext );
         }
         finally
         {
-            rwLock.writeLock().unlock();
+            unlockWrite();
         }
 
         LOG.debug( "<< RenameOperation successful" );
@@ -1141,13 +1177,13 @@ public class DefaultOperationManager imp
 
         try
         {
-            rwLock.readLock().lock();
+            lockRead();
 
             cursor = head.search( searchContext );
         }
         finally
         {
-            rwLock.readLock().unlock();
+            unlockRead();
         }
 
         LOG.debug( "<< SearchOperation successful" );



Mime
View raw message