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/09/01 04:48:18 UTC
[01/14] curator git commit: CURATOR-239 - Adding RetryForever retry
policy
Repository: curator
Updated Branches:
refs/heads/CURATOR-247 b8240a1df -> 667b1d2c7
CURATOR-239 - Adding RetryForever retry policy
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6e8c1084
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6e8c1084
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6e8c1084
Branch: refs/heads/CURATOR-247
Commit: 6e8c10847d4b453a1a1aeafcb6c58f51889f2d1f
Parents: 870b4d5
Author: Leandro Nunes <le...@blip.pt>
Authored: Fri Jul 24 00:06:26 2015 +0100
Committer: Leandro Nunes <le...@blip.pt>
Committed: Fri Jul 24 00:06:26 2015 +0100
----------------------------------------------------------------------
.../org/apache/curator/retry/RetryForever.java | 58 ++++++++++++++++++++
.../java/org/apache/curator/TestRetryLoop.java | 20 +++++++
2 files changed, 78 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/6e8c1084/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java b/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
new file mode 100644
index 0000000..27444b9
--- /dev/null
+++ b/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.curator.retry;
+
+import org.apache.curator.RetryPolicy;
+import org.apache.curator.RetrySleeper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.TimeUnit;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * {@link RetryPolicy} implementation that always <i>allowsRetry</i>.
+ */
+public class RetryForever implements RetryPolicy
+{
+ private static final Logger log = LoggerFactory.getLogger(RetryForever.class);
+
+ private final int retryIntervalMs;
+
+ public RetryForever(int retryIntervalMs)
+ {
+ checkArgument(retryIntervalMs > 0);
+ this.retryIntervalMs = retryIntervalMs;
+ }
+
+ @Override
+ public boolean allowRetry(int retryCount, long elapsedTimeMs, RetrySleeper sleeper)
+ {
+ try
+ {
+ sleeper.sleepFor(retryIntervalMs, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ log.warn("Error occurred while sleeping", e);
+ }
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/6e8c1084/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java b/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
index 0fa9020..17bb91e 100644
--- a/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
+++ b/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
@@ -19,14 +19,19 @@
package org.apache.curator;
import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.curator.retry.RetryForever;
import org.apache.curator.retry.RetryOneTime;
import org.apache.curator.test.BaseClassForTests;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs;
+import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.Test;
+
import java.util.concurrent.TimeUnit;
+import static org.mockito.Mockito.times;
+
public class TestRetryLoop extends BaseClassForTests
{
@Test
@@ -142,4 +147,19 @@ public class TestRetryLoop extends BaseClassForTests
client.close();
}
}
+
+ @Test
+ public void testRetryForever() throws Exception
+ {
+ int retryIntervalMs = 1;
+ RetrySleeper sleeper = Mockito.mock(RetrySleeper.class);
+ RetryForever retryForever = new RetryForever(retryIntervalMs);
+
+ for (int i = 0; i < 10; i++)
+ {
+ boolean allowed = retryForever.allowRetry(i, 0, sleeper);
+ Assert.assertTrue(allowed);
+ Mockito.verify(sleeper, times(i + 1)).sleepFor(retryIntervalMs, TimeUnit.MILLISECONDS);
+ }
+ }
}
[13/14] curator git commit: Merge branch 'CURATOR-3.0' into
CURATOR-247
Posted by ra...@apache.org.
Merge branch 'CURATOR-3.0' into CURATOR-247
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/72f72237
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/72f72237
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/72f72237
Branch: refs/heads/CURATOR-247
Commit: 72f722372aedc221f6dd633113b5f9c30e8bd8e2
Parents: bc57786 d01eabe
Author: randgalt <ra...@apache.org>
Authored: Mon Aug 31 19:44:24 2015 -0700
Committer: randgalt <ra...@apache.org>
Committed: Mon Aug 31 19:44:24 2015 -0700
----------------------------------------------------------------------
.../org/apache/curator/retry/RetryForever.java | 60 ++++++++++++++++++++
.../java/org/apache/curator/TestRetryLoop.java | 20 +++++++
.../framework/recipes/cache/NodeCache.java | 41 ++++++++++---
curator-x-discovery-server/pom.xml | 6 ++
curator-x-discovery/pom.xml | 6 ++
curator-x-rpc/pom.xml | 6 ++
src/site/confluence/index.confluence | 7 +++
7 files changed, 139 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
[04/14] curator git commit: Merge branch 'CURATOR-234'
Posted by ra...@apache.org.
Merge branch 'CURATOR-234'
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/5dc27c1f
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/5dc27c1f
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/5dc27c1f
Branch: refs/heads/CURATOR-247
Commit: 5dc27c1fa9b8e3bc6ed3e1b198bb1eca6b378c9a
Parents: 061ed0a b177ed7
Author: Mike Drob <md...@apache.org>
Authored: Mon Aug 24 10:41:39 2015 -0500
Committer: Mike Drob <md...@apache.org>
Committed: Mon Aug 24 10:41:39 2015 -0500
----------------------------------------------------------------------
curator-x-discovery-server/pom.xml | 6 ++++++
curator-x-discovery/pom.xml | 6 ++++++
curator-x-rpc/pom.xml | 6 ++++++
3 files changed, 18 insertions(+)
----------------------------------------------------------------------
[05/14] curator git commit: minor typo
Posted by ra...@apache.org.
minor typo
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/bc57786c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/bc57786c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/bc57786c
Branch: refs/heads/CURATOR-247
Commit: bc57786c9c55f06f8918e0e2255277bfb2fbbecb
Parents: b8240a1
Author: randgalt <ra...@apache.org>
Authored: Mon Aug 24 11:11:16 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Aug 24 11:11:16 2015 -0500
----------------------------------------------------------------------
src/site/confluence/errors.confluence | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/bc57786c/src/site/confluence/errors.confluence
----------------------------------------------------------------------
diff --git a/src/site/confluence/errors.confluence b/src/site/confluence/errors.confluence
index 0111cf4..a744128 100644
--- a/src/site/confluence/errors.confluence
+++ b/src/site/confluence/errors.confluence
@@ -26,7 +26,7 @@ appropriate action. These are the possible state changes:
|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.|
+|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.
[07/14] curator git commit: CURATOR-161 Added missing license header
Posted by ra...@apache.org.
CURATOR-161 Added missing license header
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0f5668b3
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0f5668b3
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0f5668b3
Branch: refs/heads/CURATOR-247
Commit: 0f5668b3127f280e6dd1d6d3ec665420e2d46b2d
Parents: f9af0ce
Author: Mike Drob <md...@apache.org>
Authored: Tue Aug 25 15:14:01 2015 -0500
Committer: Mike Drob <md...@apache.org>
Committed: Tue Aug 25 15:14:01 2015 -0500
----------------------------------------------------------------------
.../api/BackgroundPathableQuietlyable.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/0f5668b3/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java b/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java
index 8ed73fa..cd88739 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.curator.framework.api;
public interface BackgroundPathableQuietlyable<T> extends BackgroundPathable<T>, Quietly<BackgroundPathable<T>>
[03/14] curator git commit: CURATOR-234 Add remaining slf4j-log4j12
test deps
Posted by ra...@apache.org.
CURATOR-234 Add remaining slf4j-log4j12 test deps
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b177ed70
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b177ed70
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b177ed70
Branch: refs/heads/CURATOR-247
Commit: b177ed709a422f0b06f3a4a3683e5488d038fbb9
Parents: 9a444fa
Author: Mike Drob <md...@apache.org>
Authored: Mon Aug 24 10:40:12 2015 -0500
Committer: Mike Drob <md...@apache.org>
Committed: Mon Aug 24 10:41:09 2015 -0500
----------------------------------------------------------------------
curator-x-discovery-server/pom.xml | 6 ++++++
curator-x-discovery/pom.xml | 6 ++++++
curator-x-rpc/pom.xml | 6 ++++++
3 files changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/b177ed70/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index 2728ce5..4ed7e25 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -108,6 +108,12 @@
<artifactId>resteasy-jaxrs</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/curator/blob/b177ed70/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index 015fea7..9043533 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -66,5 +66,11 @@
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/curator/blob/b177ed70/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 299ef9f..519e8fb 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -118,6 +118,12 @@
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
[14/14] curator git commit: Use the negotiated session timeout in
checkTimeouts()
Posted by ra...@apache.org.
Use the negotiated session timeout in checkTimeouts()
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/667b1d2c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/667b1d2c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/667b1d2c
Branch: refs/heads/CURATOR-247
Commit: 667b1d2c7bd4b267585ae973dfff0f8b49f6b6ba
Parents: 72f7223
Author: randgalt <ra...@apache.org>
Authored: Mon Aug 31 19:48:12 2015 -0700
Committer: randgalt <ra...@apache.org>
Committed: Mon Aug 31 19:48:12 2015 -0700
----------------------------------------------------------------------
.../src/main/java/org/apache/curator/ConnectionState.java | 6 ++++--
.../apache/curator/connection/ConnectionHandlingPolicy.java | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/667b1d2c/curator-client/src/main/java/org/apache/curator/ConnectionState.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/ConnectionState.java b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
index f0996d8..eea2ce0 100644
--- a/curator-client/src/main/java/org/apache/curator/ConnectionState.java
+++ b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
@@ -207,7 +207,9 @@ class ConnectionState implements Watcher, Closeable
return zooKeeper.hasNewConnectionString();
}
};
- ConnectionHandlingPolicy.CheckTimeoutsResult result = connectionHandlingPolicy.checkTimeouts(hasNewConnectionString, connectionStartMs, sessionTimeoutMs, connectionTimeoutMs);
+ int lastNegotiatedSessionTimeoutMs = getLastNegotiatedSessionTimeoutMs();
+ int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs;
+ ConnectionHandlingPolicy.CheckTimeoutsResult result = connectionHandlingPolicy.checkTimeouts(hasNewConnectionString, connectionStartMs, useSessionTimeoutMs, connectionTimeoutMs);
switch ( result )
{
default:
@@ -227,7 +229,7 @@ class ConnectionState implements Watcher, Closeable
if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
{
long elapsed = System.currentTimeMillis() - connectionStartMs;
- int maxTimeout = Math.max(sessionTimeoutMs, connectionTimeoutMs);
+ int maxTimeout = Math.max(useSessionTimeoutMs, connectionTimeoutMs);
log.warn(String.format("Connection attempt unsuccessful after %d (greater than max timeout of %d). Resetting connection and trying again with a new connection.", elapsed, maxTimeout));
}
reset();
http://git-wip-us.apache.org/repos/asf/curator/blob/667b1d2c/curator-client/src/main/java/org/apache/curator/connection/ConnectionHandlingPolicy.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/connection/ConnectionHandlingPolicy.java b/curator-client/src/main/java/org/apache/curator/connection/ConnectionHandlingPolicy.java
index 6cea67d..9b6b895 100644
--- a/curator-client/src/main/java/org/apache/curator/connection/ConnectionHandlingPolicy.java
+++ b/curator-client/src/main/java/org/apache/curator/connection/ConnectionHandlingPolicy.java
@@ -63,7 +63,7 @@ public interface ConnectionHandlingPolicy
* @param hasNewConnectionString proc to call to check if there is a new connection string. Important: the internal state is cleared after
* this is called so you MUST handle the new connection string if <tt>true</tt> is returned
* @param connectionStartMs the epoch/ms time that the connection was first initiated
- * @param sessionTimeoutMs the configured session timeout in milliseconds
+ * @param sessionTimeoutMs the configured/negotiated session timeout in milliseconds
* @param connectionTimeoutMs the configured connection timeout in milliseconds
* @return result
* @throws Exception errors
[11/14] curator git commit: return false if interrupted
Posted by ra...@apache.org.
return false if interrupted
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/38011678
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/38011678
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/38011678
Branch: refs/heads/CURATOR-247
Commit: 38011678c4faebb1cd9388e56f0d13d29862c609
Parents: 35b2063
Author: randgalt <ra...@apache.org>
Authored: Mon Aug 31 07:19:21 2015 -0700
Committer: randgalt <ra...@apache.org>
Committed: Mon Aug 31 07:19:21 2015 -0700
----------------------------------------------------------------------
.../src/main/java/org/apache/curator/retry/RetryForever.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/38011678/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java b/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
index 89f0276..59f3d0d 100644
--- a/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
+++ b/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
@@ -51,8 +51,9 @@ public class RetryForever implements RetryPolicy
}
catch (InterruptedException e)
{
- log.warn("Error occurred while sleeping", e);
Thread.currentThread().interrupt();
+ log.warn("Error occurred while sleeping", e);
+ return false;
}
return true;
}
[10/14] curator git commit: Merge branch 'CURATOR-239' of
github.com:leandronunes85/curator into CURATOR-239
Posted by ra...@apache.org.
Merge branch 'CURATOR-239' of github.com:leandronunes85/curator into CURATOR-239
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/35b20630
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/35b20630
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/35b20630
Branch: refs/heads/CURATOR-247
Commit: 35b206307447d9dcc8465c941f644ee9697e4723
Parents: 8fae785 3e3a810
Author: randgalt <ra...@apache.org>
Authored: Mon Aug 31 07:17:23 2015 -0700
Committer: randgalt <ra...@apache.org>
Committed: Mon Aug 31 07:17:23 2015 -0700
----------------------------------------------------------------------
.../org/apache/curator/retry/RetryForever.java | 59 ++++++++++++++++++++
.../java/org/apache/curator/TestRetryLoop.java | 20 +++++++
2 files changed, 79 insertions(+)
----------------------------------------------------------------------
[02/14] curator git commit: CURATOR-239 - Interrupting current thread
after catching InterruptedException
Posted by ra...@apache.org.
CURATOR-239 - Interrupting current thread after catching InterruptedException
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/3e3a8103
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/3e3a8103
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/3e3a8103
Branch: refs/heads/CURATOR-247
Commit: 3e3a810312f996874c327f42c24aa5b10a91161a
Parents: 6e8c108
Author: Leandro Nunes <le...@blip.pt>
Authored: Fri Jul 24 00:18:18 2015 +0100
Committer: Leandro Nunes <le...@blip.pt>
Committed: Fri Jul 24 00:18:18 2015 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/curator/retry/RetryForever.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/3e3a8103/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java b/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
index 27444b9..89f0276 100644
--- a/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
+++ b/curator-client/src/main/java/org/apache/curator/retry/RetryForever.java
@@ -52,6 +52,7 @@ public class RetryForever implements RetryPolicy
catch (InterruptedException e)
{
log.warn("Error occurred while sleeping", e);
+ Thread.currentThread().interrupt();
}
return true;
}
[09/14] curator git commit: Include a note about 2 versions of Curator
Posted by ra...@apache.org.
Include a note about 2 versions of Curator
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/fed0bee8
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/fed0bee8
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/fed0bee8
Branch: refs/heads/CURATOR-247
Commit: fed0bee8450993bfae05d8ce9f350c1f9675de62
Parents: c9cb199
Author: randgalt <ra...@apache.org>
Authored: Sun Aug 30 14:07:27 2015 -0700
Committer: randgalt <ra...@apache.org>
Committed: Sun Aug 30 14:07:27 2015 -0700
----------------------------------------------------------------------
src/site/confluence/index.confluence | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/fed0bee8/src/site/confluence/index.confluence
----------------------------------------------------------------------
diff --git a/src/site/confluence/index.confluence b/src/site/confluence/index.confluence
index 0f0e2dc..4b5683e 100644
--- a/src/site/confluence/index.confluence
+++ b/src/site/confluence/index.confluence
@@ -39,4 +39,4 @@ h2. Versions
The are currently two released versions of Curator, 2.x.x and 3.x.x:
* Curator 2.x.x \- compatible with both ZooKeeper 3.4.x and ZooKeeper 3.5.x
-* Curator 3.x.x \- compatible only with ZooKeeper 3.5.x and includes support for new features such as containers, dynamic reconfiguration, etc.
+* Curator 3.x.x \- compatible only with ZooKeeper 3.5.x and includes support for new features such as dynamic reconfiguration, etc.
[06/14] curator git commit: CURATOR-167 - Partial fix to clean up
Curator managed watch objects when the cache closes. A full fix requires the
ability to cancel watches in ZK which is not available until ZK 3.5
Posted by ra...@apache.org.
CURATOR-167 - Partial fix to clean up Curator managed watch objects when
the cache closes. A full fix requires the ability to cancel watches in
ZK which is not available until ZK 3.5
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/8fae7856
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/8fae7856
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/8fae7856
Branch: refs/heads/CURATOR-247
Commit: 8fae7856edc1a5269fd012c683860e0b150e13b3
Parents: 5dc27c1
Author: Cameron McKenzie <ca...@unico.com.au>
Authored: Wed Nov 19 14:23:24 2014 +1100
Committer: Cam McKenzie <ca...@apache.org>
Committed: Tue Aug 25 14:06:35 2015 +1000
----------------------------------------------------------------------
.../framework/recipes/cache/NodeCache.java | 41 ++++++++++++++++----
1 file changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/8fae7856/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
index 72ee5ff..bfc27d8 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
@@ -22,19 +22,21 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
+
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.BackgroundCallback;
import org.apache.curator.framework.api.CuratorEvent;
-import org.apache.curator.framework.api.CuratorWatcher;
import org.apache.curator.framework.listen.ListenerContainer;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.framework.state.ConnectionStateListener;
import org.apache.curator.utils.PathUtils;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.Exchanger;
@@ -60,7 +62,7 @@ public class NodeCache implements Closeable
private final AtomicReference<State> state = new AtomicReference<State>(State.LATENT);
private final ListenerContainer<NodeCacheListener> listeners = new ListenerContainer<NodeCacheListener>();
private final AtomicBoolean isConnected = new AtomicBoolean(true);
- private final ConnectionStateListener connectionStateListener = new ConnectionStateListener()
+ private ConnectionStateListener connectionStateListener = new ConnectionStateListener()
{
@Override
public void stateChanged(CuratorFramework client, ConnectionState newState)
@@ -86,12 +88,19 @@ public class NodeCache implements Closeable
}
};
- private final CuratorWatcher watcher = new CuratorWatcher()
+ private Watcher watcher = new Watcher()
{
@Override
- public void process(WatchedEvent event) throws Exception
+ public void process(WatchedEvent event)
{
- reset();
+ try
+ {
+ reset();
+ }
+ catch(Exception e)
+ {
+ handleException(e);
+ }
}
};
@@ -170,8 +179,16 @@ public class NodeCache implements Closeable
if ( state.compareAndSet(State.STARTED, State.CLOSED) )
{
listeners.clear();
- }
- client.getConnectionStateListenable().removeListener(connectionStateListener);
+ client.clearWatcherReferences(watcher);
+ client.getConnectionStateListenable().removeListener(connectionStateListener);
+
+ // TODO
+ // From PathChildrenCache
+ // This seems to enable even more GC - I'm not sure why yet - it
+ // has something to do with Guava's cache and circular references
+ connectionStateListener = null;
+ watcher = null;
+ }
}
/**
@@ -312,4 +329,14 @@ public class NodeCache implements Closeable
}
}
}
+
+ /**
+ * Default behavior is just to log the exception
+ *
+ * @param e the exception
+ */
+ protected void handleException(Throwable e)
+ {
+ log.error("", e);
+ }
}
[08/14] curator git commit: Include a note about 2 versions of Curator
Posted by ra...@apache.org.
Include a note about 2 versions of Curator
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c9cb199b
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c9cb199b
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c9cb199b
Branch: refs/heads/CURATOR-247
Commit: c9cb199b07b2047487802d6d5eb90a9e96104008
Parents: 0f5668b
Author: randgalt <ra...@apache.org>
Authored: Sun Aug 30 14:04:12 2015 -0700
Committer: randgalt <ra...@apache.org>
Committed: Sun Aug 30 14:04:12 2015 -0700
----------------------------------------------------------------------
src/site/confluence/index.confluence | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/c9cb199b/src/site/confluence/index.confluence
----------------------------------------------------------------------
diff --git a/src/site/confluence/index.confluence b/src/site/confluence/index.confluence
index cd533cf..0f0e2dc 100644
--- a/src/site/confluence/index.confluence
+++ b/src/site/confluence/index.confluence
@@ -33,3 +33,10 @@ most users, the only artifact you need is curator\-recipes.
|org.apache.curator|curator\-x\-discovery|A Service Discovery implementation built on the Curator Framework.|
|org.apache.curator|curator\-x\-discovery-server|A RESTful server that can be used with Curator Discovery.|
|org.apache.curator|curator\-x\-rpc|A proxy that bridges non\-java environments with the Curator framework and recipes.|
+
+h2. Versions
+
+The are currently two released versions of Curator, 2.x.x and 3.x.x:
+
+* Curator 2.x.x \- compatible with both ZooKeeper 3.4.x and ZooKeeper 3.5.x
+* Curator 3.x.x \- compatible only with ZooKeeper 3.5.x and includes support for new features such as containers, dynamic reconfiguration, etc.
[12/14] curator git commit: Merge branch 'master' into CURATOR-3.0
Posted by ra...@apache.org.
Merge branch 'master' into CURATOR-3.0
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d01eabe5
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d01eabe5
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d01eabe5
Branch: refs/heads/CURATOR-247
Commit: d01eabe5b3ff7624fa2bd423179316931d94c1e5
Parents: fed0bee 3801167
Author: randgalt <ra...@apache.org>
Authored: Mon Aug 31 07:19:53 2015 -0700
Committer: randgalt <ra...@apache.org>
Committed: Mon Aug 31 07:19:53 2015 -0700
----------------------------------------------------------------------
.../org/apache/curator/retry/RetryForever.java | 60 ++++++++++++++++++++
.../java/org/apache/curator/TestRetryLoop.java | 20 +++++++
.../framework/recipes/cache/NodeCache.java | 41 ++++++++++---
curator-x-discovery-server/pom.xml | 6 ++
curator-x-discovery/pom.xml | 6 ++
curator-x-rpc/pom.xml | 6 ++
6 files changed, 132 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/d01eabe5/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
----------------------------------------------------------------------
diff --cc curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
index 49b9a3f,bfc27d8..8b70db1
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
@@@ -22,11 -22,10 +22,11 @@@ import com.google.common.annotations.Vi
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
+
import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.WatcherRemoveCuratorFramework;
import org.apache.curator.framework.api.BackgroundCallback;
import org.apache.curator.framework.api.CuratorEvent;
- import org.apache.curator.framework.api.CuratorWatcher;
import org.apache.curator.framework.listen.ListenerContainer;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.framework.state.ConnectionStateListener;
@@@ -170,10 -178,17 +179,18 @@@ public class NodeCache implements Close
{
if ( state.compareAndSet(State.STARTED, State.CLOSED) )
{
+ client.removeWatchers();
listeners.clear();
- }
- client.getConnectionStateListenable().removeListener(connectionStateListener);
+ client.clearWatcherReferences(watcher);
+ client.getConnectionStateListenable().removeListener(connectionStateListener);
+
+ // TODO
+ // From PathChildrenCache
+ // This seems to enable even more GC - I'm not sure why yet - it
+ // has something to do with Guava's cache and circular references
+ connectionStateListener = null;
+ watcher = null;
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/curator/blob/d01eabe5/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/d01eabe5/curator-x-discovery/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/d01eabe5/curator-x-rpc/pom.xml
----------------------------------------------------------------------