curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject curator git commit: CURATOR-211 - Fix readLockPredicate() index validation issue
Date Tue, 05 May 2015 20:07:54 GMT
Repository: curator
Updated Branches:
  refs/heads/CURATOR-211 [created] fc1151498


CURATOR-211 - Fix readLockPredicate() index validation issue

Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/fc115149
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/fc115149
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/fc115149

Branch: refs/heads/CURATOR-211
Commit: fc11514987e0ad25046fa384672c6f16408b736b
Parents: c47ae74
Author: Alexander Makarenko <estliberitas@gmail.com>
Authored: Thu Apr 30 01:37:35 2015 +0300
Committer: Alexander Makarenko <estliberitas@gmail.com>
Committed: Thu Apr 30 01:37:35 2015 +0300

----------------------------------------------------------------------
 .../framework/recipes/locks/InterProcessReadWriteLock.java        | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/fc115149/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessReadWriteLock.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessReadWriteLock.java
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessReadWriteLock.java
index 3a0dc44..57af212 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessReadWriteLock.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessReadWriteLock.java
@@ -193,7 +193,7 @@ public class InterProcessReadWriteLock
 
         int         index = 0;
         int         firstWriteIndex = Integer.MAX_VALUE;
-        int         ourIndex = Integer.MAX_VALUE;
+        int         ourIndex = -1;
         for ( String node : children )
         {
             if ( node.contains(WRITE_LOCK_NAME) )
@@ -208,6 +208,7 @@ public class InterProcessReadWriteLock
 
             ++index;
         }
+
         StandardLockInternalsDriver.validateOurIndex(sequenceNodeName, ourIndex);
 
         boolean     getsTheLock = (ourIndex < firstWriteIndex);


Mime
View raw message