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 2017/05/28 15:40:34 UTC

[3/5] curator git commit: CURATOR-106: Simplify CuratorFrameworkImpl.processBackgroundOperation a bit

CURATOR-106: Simplify CuratorFrameworkImpl.processBackgroundOperation a bit


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

Branch: refs/heads/CURATOR-106
Commit: 51d73964ef9e41a200571beb4724741b8765913f
Parents: de823f6
Author: Stig Rohde Døssing <st...@gmail.com>
Authored: Sat Apr 22 16:00:06 2017 +0200
Committer: Stig Rohde Døssing <st...@gmail.com>
Committed: Sat Apr 22 16:00:06 2017 +0200

----------------------------------------------------------------------
 .../framework/imps/CuratorFrameworkImpl.java    | 33 ++++++--------------
 1 file changed, 10 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/51d73964/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index 545b7a4..1ad974c 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -502,35 +502,22 @@ public class CuratorFrameworkImpl implements CuratorFramework
     <DATA_TYPE> void processBackgroundOperation(OperationAndData<DATA_TYPE> operationAndData, CuratorEvent event)
     {
         boolean isInitialExecution = (event == null);
-        if ( isInitialExecution )
-        {
+        if (isInitialExecution) {
             queueOperation(operationAndData);
             return;
         }
-
-        boolean doQueueOperation = false;
-        do
-        {
-            if ( RetryLoop.shouldRetry(event.getResultCode()) )
-            {
-                doQueueOperation = checkBackgroundRetry(operationAndData, event);
-                break;
-            }
-
-            if ( operationAndData.getCallback() != null )
-            {
-                sendToBackgroundCallback(operationAndData, event);
-                break;
-            }
-
-            processEvent(event);
+        
+        if(RetryLoop.shouldRetry(event.getResultCode()) && checkBackgroundRetry(operationAndData, event)) {
+            queueOperation(operationAndData);
+            return;
         }
-        while ( false );
 
-        if ( doQueueOperation )
-        {
-            queueOperation(operationAndData);
+        if (operationAndData.getCallback() != null) {
+            sendToBackgroundCallback(operationAndData, event);
+            return;
         }
+
+        processEvent(event);
     }
 
     <DATA_TYPE> void queueOperation(OperationAndData<DATA_TYPE> operationAndData)