Pull up another change for CONNECTORS-1036 from dev_1x branch
git-svn-id: https://svn.apache.org/repos/asf/manifoldcf/branches/release-1.7-branch@1625863 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java b/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
index a0a64cb..6d6ce3d 100644
--- a/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
+++ b/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/ZooKeeperConnection.java
@@ -310,7 +310,6 @@
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 @@
}
}
// 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 @@
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 @@
{
// We got it!
//System.out.println("Got write lock for '"+lockSequenceNumber+"'");
- this.lockNode = lockNode;
return;
}
@@ -421,6 +422,11 @@
// 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 @@
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 @@
}
}
// 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 @@
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 @@
if (gotLock)
{
// We got it!
- this.lockNode = lockNode;
return;
}
@@ -586,6 +593,11 @@
}
}
}
+ catch (InterruptedException e)
+ {
+ lockNode = null;
+ throw e;
+ }
catch (KeeperException e)
{
handleEphemeralNodeKeeperException(e,true);
@@ -608,7 +620,6 @@
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 @@
}
}
// 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 @@
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 @@
{
// We got it!
//System.out.println("Got read lock for '"+lockSequenceNumber+"'");
- this.lockNode = lockNode;
return;
}
@@ -754,6 +767,11 @@
}
}
+ catch (InterruptedException e)
+ {
+ lockNode = null;
+ throw e;
+ }
catch (KeeperException e)
{
handleEphemeralNodeKeeperException(e,true);