curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [07/12] git commit: patch from Evaristo to possibly finalize this change
Date Wed, 05 Feb 2014 18:42:01 GMT
patch from Evaristo to possibly finalize this change


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

Branch: refs/heads/master
Commit: f0fc51f766f608bbb0df7ac506f592407eb9be83
Parents: 8fbe4b7
Author: randgalt <randgalt@apache.org>
Authored: Mon Feb 3 09:23:03 2014 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Mon Feb 3 09:23:03 2014 -0500

----------------------------------------------------------------------
 .../apache/curator/framework/imps/CuratorFrameworkImpl.java | 7 +++++--
 .../curator/framework/state/ConnectionStateManager.java     | 9 ++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/f0fc51f7/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 d516f48..3a2a48f 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
@@ -604,7 +604,10 @@ public class CuratorFrameworkImpl implements CuratorFramework
 
     private void suspendConnection()
     {
-        connectionStateManager.setToSuspended();
+        if ( !connectionStateManager.setToSuspended() )
+        {
+            return;
+        }
 
         doSyncForSuspendedConnection(client.getInstanceIndex());
     }
@@ -782,7 +785,7 @@ public class CuratorFrameworkImpl implements CuratorFramework
                 }
                 else
                 {
-                    handleBackgroundOperationException(operationAndData, e);
+                	logError("Background retry gave up", e);
                 }
             }
             else

http://git-wip-us.apache.org/repos/asf/curator/blob/f0fc51f7/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index a2cfa60..42804b8 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -136,21 +136,24 @@ public class ConnectionStateManager implements Closeable
 
     /**
      * Change to {@link ConnectionState#SUSPENDED} only if not already suspended and not
lost
+     * 
+     * @return true if connection is set to SUSPENDED
      */
-    public synchronized void setToSuspended()
+    public synchronized boolean setToSuspended()
     {
         if ( state.get() != State.STARTED )
         {
-            return;
+            return false;
         }
 
         if ( (currentConnectionState == ConnectionState.LOST) || (currentConnectionState
== ConnectionState.SUSPENDED) )
         {
-            return;
+            return false;
         }
 
         currentConnectionState = ConnectionState.SUSPENDED;
         postState(ConnectionState.SUSPENDED);
+        return true;
     }
 
     /**


Mime
View raw message