You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2014/05/23 14:52:57 UTC

[3/8] git commit: No need for null check

No need for null check


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

Branch: refs/heads/master
Commit: ac57e11b34bb2970775b385f5a1e94bccd287232
Parents: c971649
Author: Dominic Wong <do...@hailocab.com>
Authored: Wed May 21 13:45:54 2014 +0100
Committer: Dominic Wong <do...@hailocab.com>
Committed: Wed May 21 13:45:54 2014 +0100

----------------------------------------------------------------------
 .../framework/recipes/locks/LockInternals.java  | 27 +++++++++-----------
 1 file changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/ac57e11b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
index c66e4d1..d6298ce 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
@@ -298,24 +298,21 @@ public class LockInternals
                         try 
                         {
                             byte[] data = client.getData().usingWatcher(watcher).forPath(previousSequencePath);
-                            if ( data != null )
+                            if ( millisToWait != null )
                             {
-                                if ( millisToWait != null )
+                                millisToWait -= (System.currentTimeMillis() - startMillis);
+                                startMillis = System.currentTimeMillis();
+                                if ( millisToWait <= 0 )
                                 {
-                                    millisToWait -= (System.currentTimeMillis() - startMillis);
-                                    startMillis = System.currentTimeMillis();
-                                    if ( millisToWait <= 0 )
-                                    {
-                                        doDelete = true;    // timed out - delete our node
-                                        break;
-                                    }
-
-                                    wait(millisToWait);
-                                }
-                                else
-                                {
-                                    wait();
+                                    doDelete = true;    // timed out - delete our node
+                                    break;
                                 }
+
+                                wait(millisToWait);
+                            }
+                            else
+                            {
+                                wait();
                             }
                         }
                         catch ( KeeperException.NoNodeException e )