Author: kwright
Date: Thu Sep 18 00:19:57 2014
New Revision: 1625862

URL: http://svn.apache.org/r1625862
Log:
Pull up another fix for CONNECTORS-1036 from trunk.

Modified:
    manifoldcf/branches/dev_1x/   (props changed)
    
manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java

Propchange: manifoldcf/branches/dev_1x/
------------------------------------------------------------------------------
  Merged /manifoldcf/trunk:r1625861

Modified: 
manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java?rev=1625862&r1=1625861&r2=1625862&view=diff
==============================================================================
--- 
manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
 (original)
+++ 
manifoldcf/branches/dev_1x/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
 Thu Sep 18 00:19:57 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