Author: kwright
Date: Thu Sep 18 00:18:24 2014
New Revision: 1625861

URL: http://svn.apache.org/r1625861
Log:
Finish CONNECTORS-1036.

Modified:
    
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java

Modified: 
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java?rev=1625861&r1=1625860&r2=1625861&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
 (original)
+++ 
manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
 Thu Sep 18 00:18:24 2014
@@ -310,7 +310,6 @@ public class ZooKeeperConnection
       try
       {
         // Assert that we want a write lock
-        String lockNode = this.lockNode;
         if (lockNode == null)
           lockNode = createSequentialChild(lockPath,WRITE_PREFIX);
         String lockSequenceNumber = lockNode.substring(lockPath.length() + 1 + 
WRITE_PREFIX.length());
@@ -335,9 +334,13 @@ public class ZooKeeperConnection
           }
         }
         // We got it!
-        this.lockNode = lockNode;
         return true;
       }
+      catch (InterruptedException e)
+      {
+        lockNode = null;
+        throw e;
+      }
       catch (KeeperException e)
       {
         handleEphemeralNodeKeeperException(e,true);
@@ -359,7 +362,6 @@ public class ZooKeeperConnection
       try
       {
         // Assert that we want a write lock
-        String lockNode = this.lockNode;
         if (lockNode == null)
           lockNode = createSequentialChild(lockPath,WRITE_PREFIX);
         long lockSequenceNumber = new 
Long(lockNode.substring(lockPath.length() + 1 + 
WRITE_PREFIX.length())).longValue();
@@ -402,7 +404,6 @@ public class ZooKeeperConnection
           {
             // We got it!
             //System.out.println("Got write lock for 
'"+lockSequenceNumber+"'");
-            this.lockNode = lockNode;
             return;
           }
 
@@ -421,6 +422,11 @@ public class ZooKeeperConnection
           //  System.out.println(" Retrying for write lock 
'"+lockSequenceNumber+"'");
         }
       }
+      catch (InterruptedException e)
+      {
+        lockNode = null;
+        throw e;
+      }
       catch (KeeperException e)
       {
         handleEphemeralNodeKeeperException(e,true);
@@ -443,7 +449,6 @@ public class ZooKeeperConnection
       try
       {
         // Assert that we want a read lock
-        String lockNode = this.lockNode;
         if (lockNode == null)
           lockNode = createSequentialChild(lockPath,NONEXWRITE_PREFIX);
         String lockSequenceNumber = lockNode.substring(lockPath.length() + 1 + 
NONEXWRITE_PREFIX.length());
@@ -488,9 +493,13 @@ public class ZooKeeperConnection
           }
         }
         // We got it!
-        this.lockNode = lockNode;
         return true;
       }
+      catch (InterruptedException e)
+      {
+        lockNode = null;
+        throw e;
+      }
       catch (KeeperException e)
       {
         handleEphemeralNodeKeeperException(e,true);
@@ -512,7 +521,6 @@ public class ZooKeeperConnection
       try
       {
         // Assert that we want a read lock
-        String lockNode = this.lockNode;
         if (lockNode == null)
           lockNode = createSequentialChild(lockPath,NONEXWRITE_PREFIX);
         long lockSequenceNumber = new 
Long(lockNode.substring(lockPath.length() + 1 + 
NONEXWRITE_PREFIX.length())).longValue();
@@ -570,7 +578,6 @@ public class ZooKeeperConnection
           if (gotLock)
           {
             // We got it!
-            this.lockNode = lockNode;
             return;
           }
 
@@ -586,6 +593,11 @@ public class ZooKeeperConnection
           }
         }
       }
+      catch (InterruptedException e)
+      {
+        lockNode = null;
+        throw e;
+      }
       catch (KeeperException e)
       {
         handleEphemeralNodeKeeperException(e,true);
@@ -608,7 +620,6 @@ public class ZooKeeperConnection
       try
       {
         // Assert that we want a read lock
-        String lockNode = this.lockNode;
         if (lockNode == null)
           lockNode = createSequentialChild(lockPath,READ_PREFIX);
         String lockSequenceNumber = lockNode.substring(lockPath.length() + 1 + 
READ_PREFIX.length());
@@ -649,9 +660,13 @@ public class ZooKeeperConnection
           }
         }
         // We got it!
-        this.lockNode= lockNode;
         return true;
       }
+      catch (InterruptedException e)
+      {
+        lockNode = null;
+        throw e;
+      }
       catch (KeeperException e)
       {
         handleEphemeralNodeKeeperException(e,true);
@@ -673,7 +688,6 @@ public class ZooKeeperConnection
       try
       {
         // Assert that we want a read lock
-        String lockNode = this.lockNode;
         if (lockNode == null)
           lockNode = createSequentialChild(lockPath,READ_PREFIX);
         long lockSequenceNumber = new 
Long(lockNode.substring(lockPath.length() + 1 + 
READ_PREFIX.length())).longValue();
@@ -734,7 +748,6 @@ public class ZooKeeperConnection
           {
             // We got it!
             //System.out.println("Got read lock for '"+lockSequenceNumber+"'");
-            this.lockNode = lockNode;
             return;
           }
 
@@ -754,6 +767,11 @@ public class ZooKeeperConnection
 
         }
       }
+      catch (InterruptedException e)
+      {
+        lockNode = null;
+        throw e;
+      }
       catch (KeeperException e)
       {
         handleEphemeralNodeKeeperException(e,true);


Reply via email to