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 2015/08/24 16:28:55 UTC

curator git commit: updated doc

Repository: curator
Updated Branches:
  refs/heads/CURATOR-247 1bbf301ab -> b8240a1df


updated doc


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

Branch: refs/heads/CURATOR-247
Commit: b8240a1dfcaf291196dc68fbfd1f2204c50951fc
Parents: 1bbf301
Author: randgalt <ra...@apache.org>
Authored: Mon Aug 24 09:28:53 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Aug 24 09:28:53 2015 -0500

----------------------------------------------------------------------
 .../curator/framework/CuratorFrameworkFactory.java       |  2 +-
 .../apache/curator/framework/state/ConnectionState.java  |  7 ++++---
 .../framework/imps/TestEnabledSessionExpiredState.java   | 11 +++++++++++
 src/site/confluence/errors.confluence                    |  6 +++---
 4 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/b8240a1d/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java b/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
index c59d78f..daffa13 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
@@ -381,7 +381,7 @@ public class CuratorFrameworkFactory
          *         action. In Curator, this is complicated by the fact that Curator internally manages the ZooKeeper
          *         connection. Now, Curator will set the LOST state when any of the following occurs:
          *         a) ZooKeeper returns a {@link Watcher.Event.KeeperState#Expired} or {@link KeeperException.Code#SESSIONEXPIRED};
-         *         b) Curator closes the internally managed ZooKeeper instance; c) The configured session timeout
+         *         b) Curator closes the internally managed ZooKeeper instance; c) The session timeout
          *         elapses during a network partition.
          *     </li>
          * </ul>

http://git-wip-us.apache.org/repos/asf/curator/blob/b8240a1d/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionState.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionState.java b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionState.java
index fe40abf..f9f245a 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionState.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionState.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator.framework.state;
 
+import org.apache.curator.connection.ConnectionHandlingPolicy;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.Watcher;
@@ -64,17 +65,17 @@ public enum ConnectionState
 
     /**
      * <p>
-     *     Curator will set the LOST state only when it believes that the ZooKeeper session
+     *     Curator will set the LOST state when it believes that the ZooKeeper session
      *     has expired. ZooKeeper connections have a session. When the session expires, clients must take appropriate
      *     action. In Curator, this is complicated by the fact that Curator internally manages the ZooKeeper
      *     connection. Curator will set the LOST state when any of the following occurs:
      *     a) ZooKeeper returns a {@link Watcher.Event.KeeperState#Expired} or {@link KeeperException.Code#SESSIONEXPIRED};
-     *     b) Curator closes the internally managed ZooKeeper instance; c) The configured session timeout
+     *     b) Curator closes the internally managed ZooKeeper instance; c) The session timeout
      *     elapses during a network partition.
      * </p>
      *
      * <p>
-     *     NOTE: see {@link CuratorFrameworkFactory.Builder#connectionHandlingPolicy} for an important note about a
+     *     NOTE: see {@link CuratorFrameworkFactory.Builder#connectionHandlingPolicy(ConnectionHandlingPolicy)} for an important note about a
      *     change in meaning to LOST since 3.0.0
      * </p>
      */

http://git-wip-us.apache.org/repos/asf/curator/blob/b8240a1d/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java
index eff899d..490e75e 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java
@@ -82,6 +82,17 @@ public class TestEnabledSessionExpiredState extends BaseClassForTests
     }
 
     @Test
+    public void testResetCausesLost() throws Exception
+    {
+        Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.CONNECTED);
+        client.checkExists().forPath("/");  // establish initial connection
+
+        client.getZookeeperClient().reset();
+        Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.LOST);
+        Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.RECONNECTED);
+    }
+
+    @Test
     public void testInjectedWatchedEvent() throws Exception
     {
         Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.CONNECTED);

http://git-wip-us.apache.org/repos/asf/curator/blob/b8240a1d/src/site/confluence/errors.confluence
----------------------------------------------------------------------
diff --git a/src/site/confluence/errors.confluence b/src/site/confluence/errors.confluence
index 28805e0..0111cf4 100644
--- a/src/site/confluence/errors.confluence
+++ b/src/site/confluence/errors.confluence
@@ -23,10 +23,10 @@ Curator exposes several listenable interfaces for clients to monitor the state o
 appropriate action. These are the possible state changes:
 
 |CONNECTED|Sent for the first successful connection to the server. NOTE: You will only get one of these messages for any CuratorFramework instance.|
-|SUSPENDED|There has been a loss of connection. Leaders, locks, etc. should suspend until the connection is re\-established. If the connection times\-out you will receive a LOST notice.|
-|RECONNECTED|A suspended or lost connection has been re\-established.|
-|LOST|The connection is confirmed to be lost. Close any locks, leaders, etc. and attempt to re\-create them. NOTE: it is possible to get a RECONNECTED state after this but you should still consider any locks, etc. as dirty/unstable.|
 |READ_ONLY|The connection has gone into read\-only mode. This can only happen if you pass true for CuratorFrameworkFactory.Builder.canBeReadOnly(). See the ZooKeeper doc regarding read only connections: [[http://wiki.apache.org/hadoop/ZooKeeper/GSoCReadOnlyMode]]. The connection will remain in read only mode until another state change is sent.|
+|SUSPENDED|There has been a loss of connection. Leaders, locks, etc. should suspend until the connection is re\-established.|
+|RECONNECTED|A suspended or lost connection has been re\-established.|
+|LOST|Curator will set the LOST state when it believes that the ZooKeeper session has expired. ZooKeeper connections have a session. When the session expires, clients must take appropriate action. In Curator, this is complicated by the fact that Curator internally manages the ZooKeeper connection. Curator will set the LOST state when any of the following occurs: a) ZooKeeper returns a Watcher.Event.KeeperState.Expired or KeeperException.Code.SESSIONEXPIRED; b) Curator closes the internally managed ZooKeeper instance; c) The session timeout elapses during a network partition. It is possible to get a RECONNECTED state after this but you should still consider any locks, etc. as dirty/unstable. *NOTE* The meaning of LOST has changed since Curator 3.0.0. Prior to 3.0.0 LOST only meant that the retry policy had expired.|
 
 {{UnhandledErrorListener}} is called when a background task, etc. catches an exception. In general, Curator users shouldn't care
 about these as they are logged. However, you can listen for them if you choose.