You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ca...@apache.org on 2015/04/22 01:06:58 UTC
[01/50] curator git commit: Added method to provide old behavior
Repository: curator
Updated Branches:
refs/heads/CURATOR-154 64973b0d9 -> 6e16d0d5c
Added method to provide old behavior
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/40b2cd80
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/40b2cd80
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/40b2cd80
Branch: refs/heads/CURATOR-154
Commit: 40b2cd80206fc4b9327f5033d0873375a8706c4a
Parents: 870b658
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 14:37:20 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 14:37:20 2015 -0500
----------------------------------------------------------------------
.../src/main/java/org/apache/curator/utils/ThreadUtils.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/40b2cd80/curator-client/src/main/java/org/apache/curator/utils/ThreadUtils.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/utils/ThreadUtils.java b/curator-client/src/main/java/org/apache/curator/utils/ThreadUtils.java
index ca1080d..8960ec0 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/ThreadUtils.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/ThreadUtils.java
@@ -48,10 +48,7 @@ public class ThreadUtils
public static ThreadFactory newThreadFactory(String processName)
{
- return new ThreadFactoryBuilder()
- .setNameFormat("Curator-" + processName + "-%d")
- .setDaemon(true)
- .build();
+ return newGenericThreadFactory("Curator-" + processName);
}
public static ThreadFactory newGenericThreadFactory(String processName)
[36/50] curator git commit: Merge branch 'CURATOR-190'
Posted by ca...@apache.org.
Merge branch 'CURATOR-190'
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6a56c514
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6a56c514
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6a56c514
Branch: refs/heads/CURATOR-154
Commit: 6a56c5145bf800498b4f92c0d94eaecf1941bbed
Parents: 67b122d 9fe802e
Author: Cameron McKenzie <ca...@unico.com.au>
Authored: Thu Apr 2 09:11:47 2015 +1100
Committer: Cameron McKenzie <ca...@unico.com.au>
Committed: Thu Apr 2 09:11:47 2015 +1100
----------------------------------------------------------------------
.../recipes/nodes/PersistentEphemeralNode.java | 2 +-
.../nodes/TestPersistentEphemeralNode.java | 39 ++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[32/50] curator git commit: Adding the notion of a 'lock schema' to
ChildReaper that enables it to reap both the direct children its watching and
subnodes of those children. This is necessary with InterProcessSemaphoreV2 as
it creates multiple subnodes
Posted by ca...@apache.org.
Adding the notion of a 'lock schema' to ChildReaper that enables it to reap both the direct children its watching and subnodes of those children. This is necessary with InterProcessSemaphoreV2 as it creates multiple subnodes beneath its lock nodes and otherwise is unreapable with ChildReaper
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/72aea4a3
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/72aea4a3
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/72aea4a3
Branch: refs/heads/CURATOR-154
Commit: 72aea4a30b36201fe2a673358c1e062d6b5109a7
Parents: 49eb02a
Author: David Kesler <dk...@yodle.com>
Authored: Mon Feb 9 16:34:20 2015 -0500
Committer: David Kesler <dk...@yodle.com>
Committed: Mon Feb 9 16:34:20 2015 -0500
----------------------------------------------------------------------
.../framework/recipes/locks/ChildReaper.java | 35 +++++++++++++++--
.../recipes/locks/InterProcessSemaphoreV2.java | 8 ++++
.../framework/recipes/locks/LockSchema.java | 22 +++++++++++
.../locks/TestInterProcessSemaphore.java | 40 ++++++++++++++++++++
4 files changed, 101 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/72aea4a3/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
index 56c56ab..7935f0b 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
@@ -55,6 +55,7 @@ public class ChildReaper implements Closeable
private final CloseableScheduledExecutorService executor;
private final int reapingThresholdMs;
private final LeaderLatch leaderLatch;
+ private final LockSchema lockSchema;
private volatile Future<?> task;
@@ -108,6 +109,21 @@ public class ChildReaper implements Closeable
*/
public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath)
{
+ this(client, path, mode, executor, reapingThresholdMs, leaderPath, new LockSchema());
+ }
+
+
+ /**
+ * @param client the client
+ * @param path path to reap children from
+ * @param executor executor to use for background tasks
+ * @param reapingThresholdMs threshold in milliseconds that determines that a path can be deleted
+ * @param mode reaping mode
+ * @param leaderPath if not null, uses a leader selection so that only 1 reaper is active in the cluster
+ * @param lockSchema a set of the possible subnodes of the children of path that must be reaped in addition to the child nodes
+ */
+ public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath, LockSchema lockSchema)
+ {
this.client = client;
this.mode = mode;
this.executor = new CloseableScheduledExecutorService(executor);
@@ -121,6 +137,7 @@ public class ChildReaper implements Closeable
leaderLatch = null;
}
this.reaper = new Reaper(client, executor, reapingThresholdMs, leaderLatch);
+ this.lockSchema = lockSchema;
addPath(path);
}
@@ -207,12 +224,13 @@ public class ChildReaper implements Closeable
List<String> children = client.getChildren().forPath(path);
for ( String name : children )
{
- String thisPath = ZKPaths.makePath(path, name);
- Stat stat = client.checkExists().forPath(thisPath);
- if ( (stat != null) && (stat.getNumChildren() == 0) )
+ String childPath = ZKPaths.makePath(path, name);
+ addPathToReaperIfEmpty(childPath);
+ for ( String subNode : lockSchema.getPaths() )
{
- reaper.addPath(thisPath, mode);
+ addPathToReaperIfEmpty(ZKPaths.makePath(childPath, subNode));
}
+
}
}
catch ( Exception e )
@@ -223,6 +241,15 @@ public class ChildReaper implements Closeable
}
}
+ private void addPathToReaperIfEmpty(String path) throws Exception
+ {
+ Stat stat = client.checkExists().forPath(path);
+ if ( (stat != null) && (stat.getNumChildren() == 0) )
+ {
+ reaper.addPath(path, mode);
+ }
+ }
+
private boolean shouldDoWork()
{
return this.leaderLatch == null || this.leaderLatch.hasLeadership();
http://git-wip-us.apache.org/repos/asf/curator/blob/72aea4a3/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
index 2e14ee1..55647ad 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
@@ -21,6 +21,8 @@ package org.apache.curator.framework.recipes.locks;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Sets;
+
import org.apache.curator.utils.CloseableUtils;
import org.apache.curator.RetryLoop;
import org.apache.curator.framework.CuratorFramework;
@@ -92,6 +94,12 @@ public class InterProcessSemaphoreV2
private static final String LOCK_PARENT = "locks";
private static final String LEASE_PARENT = "leases";
private static final String LEASE_BASE_NAME = "lease-";
+ public static final LockSchema LOCK_SCHEMA = new LockSchema(
+ Sets.newHashSet(
+ LOCK_PARENT,
+ LEASE_PARENT
+ )
+ );
/**
* @param client the client
http://git-wip-us.apache.org/repos/asf/curator/blob/72aea4a3/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
new file mode 100644
index 0000000..5794705
--- /dev/null
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
@@ -0,0 +1,22 @@
+package org.apache.curator.framework.recipes.locks;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.google.common.collect.Sets;
+
+public class LockSchema {
+ private final Set<String> paths;
+
+ public LockSchema() {
+ paths = new HashSet<String>();
+ }
+
+ public LockSchema(Set<String> paths) {
+ this.paths = Sets.newHashSet(paths);
+ }
+
+ public Set<String> getPaths() {
+ return Sets.newHashSet(paths);
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/72aea4a3/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
index dd3f98f..631b7c7 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
@@ -531,4 +531,44 @@ public class TestInterProcessSemaphore extends BaseClassForTests
CloseableUtils.closeQuietly(client);
}
}
+
+ @Test
+ public void testChildReaperCleansUpLockNodes() throws Exception
+ {
+ Timing timing = new Timing();
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+ client.start();
+
+ ChildReaper childReaper = null;
+ try
+ {
+ InterProcessSemaphoreV2 semaphore = new InterProcessSemaphoreV2(client, "/test/lock", 1);
+ semaphore.returnLease(semaphore.acquire(timing.forWaiting().seconds(), TimeUnit.SECONDS));
+
+ Assert.assertTrue(client.getChildren().forPath("/test").size() > 0);
+
+ childReaper = new ChildReaper(
+ client,
+ "/test",
+ Reaper.Mode.REAP_UNTIL_GONE,
+ ChildReaper.newExecutorService(),
+ 1,
+ "/test-leader",
+ InterProcessSemaphoreV2.LOCK_SCHEMA
+ );
+ childReaper.start();
+
+ timing.forWaiting().sleepABit();
+
+ List<String> children = client.getChildren().forPath("/test");
+
+ Assert.assertEquals(children.size(), 0, "All children of /test should have been reaped");
+ }
+ finally
+ {
+ CloseableUtils.closeQuietly(childReaper);
+ CloseableUtils.closeQuietly(client);
+ }
+
+ }
}
[33/50] curator git commit: CURATOR-190 - Modified to always use the
base name when creating protected ephemeral nodes. This prevents the current
protected name being appended to the name each time the node is created,
which in turn prevents multiple nod
Posted by ca...@apache.org.
CURATOR-190 - Modified to always use the base name when creating protected
ephemeral nodes. This prevents the current protected name being appended
to the name each time the node is created, which in turn prevents multiple
nodes being created.
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9fe802ec
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9fe802ec
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9fe802ec
Branch: refs/heads/CURATOR-154
Commit: 9fe802ec238b8ae7b5f77e61cac7e25c8f42f6d9
Parents: 49eb02a
Author: Cameron McKenzie <ca...@unico.com.au>
Authored: Wed Mar 4 09:09:01 2015 +1100
Committer: Cameron McKenzie <ca...@unico.com.au>
Committed: Wed Mar 4 09:09:01 2015 +1100
----------------------------------------------------------------------
.../recipes/nodes/PersistentEphemeralNode.java | 2 +-
.../nodes/TestPersistentEphemeralNode.java | 39 ++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/9fe802ec/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
index d78573c..cfc4cbc 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
@@ -336,7 +336,7 @@ public class PersistentEphemeralNode implements Closeable
try
{
String existingPath = nodePath.get();
- String createPath = (existingPath != null) ? existingPath : basePath;
+ String createPath = (existingPath != null && !mode.isProtected()) ? existingPath : basePath;
createMethod.withMode(mode.getCreateMode(existingPath != null)).inBackground(backgroundCallback).forPath(createPath, data.get());
}
catch ( Exception e )
http://git-wip-us.apache.org/repos/asf/curator/blob/9fe802ec/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
index 47ae757..8bc8d3d 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
@@ -20,6 +20,7 @@ package org.apache.curator.framework.recipes.nodes;
import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
+
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.state.ConnectionState;
@@ -37,9 +38,11 @@ import org.apache.zookeeper.data.Stat;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
+
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@@ -459,6 +462,42 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
node.close();
}
}
+
+ /**
+ * See CURATOR-190
+ * For protected nodes on reconnect the current protected name was passed to the create builder meaning that it got
+ * appended to the new protected node name. This meant that a new node got created on each reconnect.
+ * @throws Exception
+ */
+ @Test
+ public void testProtected() throws Exception
+ {
+ CuratorFramework curator = newCurator();
+
+ PersistentEphemeralNode node = new PersistentEphemeralNode(curator, PersistentEphemeralNode.Mode.PROTECTED_EPHEMERAL, PATH,
+ new byte[0]);
+ node.start();
+ try
+ {
+ node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
+ assertNodeExists(curator, node.getActualPath());
+
+ server.restart();
+
+ curator.blockUntilConnected(5, TimeUnit.SECONDS);
+
+ assertNodeExists(curator, node.getActualPath());
+
+ //There should only be a single child, the persisted ephemeral node
+ List<String> children = curator.getChildren().forPath(DIR);
+ assertFalse(children == null);
+ assertEquals(children.size(), 1);
+ }
+ finally
+ {
+ node.close();
+ }
+ }
private void assertNodeExists(CuratorFramework curator, String path) throws Exception
{
[22/50] curator git commit: Final fix for backward compat ACL APIs
and tests
Posted by ca...@apache.org.
Final fix for backward compat ACL APIs and tests
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/570352d5
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/570352d5
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/570352d5
Branch: refs/heads/CURATOR-154
Commit: 570352d547ad32270109692abccc2ea30ea74294
Parents: 34bd3e8
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 13 08:28:14 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jan 13 08:28:14 2015 -0500
----------------------------------------------------------------------
.../framework/CuratorFrameworkFactory.java | 10 ++--
.../curator/framework/imps/TestFramework.java | 60 ++++++++++++--------
2 files changed, 43 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/570352d5/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 fdcae48..11cee2d 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
@@ -19,7 +19,6 @@
package org.apache.curator.framework;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import org.apache.curator.RetryPolicy;
import org.apache.curator.ensemble.EnsembleProvider;
@@ -382,7 +381,8 @@ public class CuratorFrameworkFactory
@Deprecated
public String getAuthScheme()
{
- switch ( authInfos.size() )
+ int qty = (authInfos != null) ? authInfos.size() : 0;
+ switch ( qty )
{
case 0:
{
@@ -404,7 +404,8 @@ public class CuratorFrameworkFactory
@Deprecated
public byte[] getAuthValue()
{
- switch ( authInfos.size() )
+ int qty = (authInfos != null) ? authInfos.size() : 0;
+ switch ( qty )
{
case 0:
{
@@ -413,7 +414,8 @@ public class CuratorFrameworkFactory
case 1:
{
- return authInfos.get(0).getAuth();
+ byte[] bytes = authInfos.get(0).getAuth();
+ return (bytes != null) ? Arrays.copyOf(bytes, bytes.length) : null;
}
default:
http://git-wip-us.apache.org/repos/asf/curator/blob/570352d5/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index 6c71f2c..0d98f1d 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -227,7 +227,21 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testCreateACLMultipleAuths() throws Exception
+ public void testACLDeprecatedApis() throws Exception
+ {
+ CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
+ .connectString(server.getConnectString())
+ .retryPolicy(new RetryOneTime(1));
+ Assert.assertNull(builder.getAuthScheme());
+ Assert.assertNull(builder.getAuthValue());
+
+ builder = builder.authorization("digest", "me1:pass1".getBytes());
+ Assert.assertEquals(builder.getAuthScheme(), "digest");
+ Assert.assertEquals(builder.getAuthValue(), "me1:pass1".getBytes());
+ }
+
+ @Test
+ public void testCreateACLMultipleAuths() throws Exception
{
// Add a few authInfos
List<AuthInfo> authInfos = new ArrayList<AuthInfo>();
@@ -483,20 +497,20 @@ public class TestFramework extends BaseClassForTests
try
{
client.getCuratorListenable().addListener
- (
- new CuratorListener()
- {
- @Override
- public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
+ (
+ new CuratorListener()
{
- if ( event.getType() == CuratorEventType.SYNC )
+ @Override
+ public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
{
- Assert.assertEquals(event.getPath(), "/head");
- ((CountDownLatch)event.getContext()).countDown();
+ if ( event.getType() == CuratorEventType.SYNC )
+ {
+ Assert.assertEquals(event.getPath(), "/head");
+ ((CountDownLatch)event.getContext()).countDown();
+ }
}
}
- }
- );
+ );
client.create().forPath("/head");
Assert.assertNotNull(client.checkExists().forPath("/head"));
@@ -587,20 +601,20 @@ public class TestFramework extends BaseClassForTests
try
{
client.getCuratorListenable().addListener
- (
- new CuratorListener()
+ (
+ new CuratorListener()
+ {
+ @Override
+ public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
+ {
+ if ( event.getType() == CuratorEventType.DELETE )
{
- @Override
- public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
- {
- if ( event.getType() == CuratorEventType.DELETE )
- {
- Assert.assertEquals(event.getPath(), "/one/two");
- ((CountDownLatch)event.getContext()).countDown();
- }
- }
+ Assert.assertEquals(event.getPath(), "/one/two");
+ ((CountDownLatch)event.getContext()).countDown();
}
- );
+ }
+ }
+ );
client.create().creatingParentsIfNeeded().forPath("/one/two/three/four");
Assert.assertNotNull(client.checkExists().forPath("/one/two/three/four"));
[11/50] curator git commit: fixed license url
Posted by ca...@apache.org.
fixed license url
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b8715ca8
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b8715ca8
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b8715ca8
Branch: refs/heads/CURATOR-154
Commit: b8715ca8cd7e612daeffa3be69442839d051dee6
Parents: b3fb2cf
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 21:34:10 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 21:34:10 2015 -0500
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/b8715ca8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6dd5d14..3f2d4f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,7 @@
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
- <url>file://${basedir}/LICENSE</url>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
[47/50] curator git commit: Merge branch 'CURATOR-186'
Posted by ca...@apache.org.
Merge branch 'CURATOR-186'
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/2347b57d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/2347b57d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/2347b57d
Branch: refs/heads/CURATOR-154
Commit: 2347b57d526b79680dd340462722f72286661670
Parents: 5f291bb de23cae
Author: randgalt <ra...@apache.org>
Authored: Tue Apr 21 10:57:31 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Apr 21 10:57:31 2015 -0500
----------------------------------------------------------------------
.../main/java/discovery/InstanceDetails.java | 2 +-
.../contexts/GenericDiscoveryContext.java | 8 ++++----
.../contexts/IntegerDiscoveryContext.java | 4 ++--
.../server/contexts/StringDiscoveryContext.java | 4 ++--
.../entity/JsonServiceInstanceMarshaller.java | 6 +++---
.../entity/JsonServiceInstancesMarshaller.java | 8 ++++----
.../entity/JsonServiceNamesMarshaller.java | 8 ++++----
.../discovery/server/rest/DiscoveryContext.java | 4 ++--
.../server/jetty_jersey/ServiceDetails.java | 4 ++--
curator-x-discovery/pom.xml | 14 ++++++++++++--
.../curator/x/discovery/ServiceInstance.java | 6 ++----
.../details/JsonInstanceSerializer.java | 4 ++--
.../java/org/apache/curator/x/rpc/RpcTests.java | 6 +++---
pom.xml | 20 ++++++++++++++++----
14 files changed, 59 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
[37/50] curator git commit: Merge branch 'CURATOR-186' of
https://github.com/xoom/curator into CURATOR-186
Posted by ca...@apache.org.
Merge branch 'CURATOR-186' of https://github.com/xoom/curator into CURATOR-186
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/de23cae9
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/de23cae9
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/de23cae9
Branch: refs/heads/CURATOR-154
Commit: de23cae9e5dcb2681f2a0934c2fbb8fd7570ff0b
Parents: 6a56c51 4bd2c0b
Author: randgalt <ra...@apache.org>
Authored: Wed Apr 1 17:22:35 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Wed Apr 1 17:22:35 2015 -0500
----------------------------------------------------------------------
.../main/java/discovery/InstanceDetails.java | 2 +-
.../contexts/GenericDiscoveryContext.java | 8 ++++----
.../contexts/IntegerDiscoveryContext.java | 4 ++--
.../server/contexts/StringDiscoveryContext.java | 4 ++--
.../entity/JsonServiceInstanceMarshaller.java | 6 +++---
.../entity/JsonServiceInstancesMarshaller.java | 8 ++++----
.../entity/JsonServiceNamesMarshaller.java | 8 ++++----
.../discovery/server/rest/DiscoveryContext.java | 4 ++--
.../server/jetty_jersey/ServiceDetails.java | 4 ++--
curator-x-discovery/pom.xml | 14 ++++++++++++--
.../curator/x/discovery/ServiceInstance.java | 6 ++----
.../details/JsonInstanceSerializer.java | 4 ++--
.../java/org/apache/curator/x/rpc/RpcTests.java | 6 +++---
pom.xml | 20 ++++++++++++++++----
14 files changed, 59 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
[23/50] curator git commit: [maven-release-plugin] prepare release
apache-curator-2.7.1
Posted by ca...@apache.org.
[maven-release-plugin] prepare release apache-curator-2.7.1
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/09e9a55c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/09e9a55c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/09e9a55c
Branch: refs/heads/CURATOR-154
Commit: 09e9a55c94bd52bab712a546f90e6390584f209a
Parents: 570352d
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 13 08:30:38 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jan 13 08:30:38 2015 -0500
----------------------------------------------------------------------
curator-client/pom.xml | 4 ++--
curator-examples/pom.xml | 2 +-
curator-framework/pom.xml | 4 ++--
curator-recipes/pom.xml | 4 ++--
curator-test/pom.xml | 4 ++--
curator-x-discovery-server/pom.xml | 4 ++--
curator-x-discovery/pom.xml | 4 ++--
curator-x-rpc/pom.xml | 4 ++--
pom.xml | 4 ++--
9 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index cd0af80..b21ab7e 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-client</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Client</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index 1728ec9..8a55dc0 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-examples</artifactId>
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index 446c2fd..f5b309d 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-framework</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Framework</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 4955dde..348cc48 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-recipes</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Recipes</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 5b6352a..67bac8c 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-test</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<name>Curator Testing</name>
<description>Unit testing utilities.</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index f6851be..fcbbafa 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-x-discovery-server</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery Server</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index 69d8410..1688ae2 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-x-discovery</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 0e0b528..749deea 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>apache-curator</artifactId>
<groupId>org.apache.curator</groupId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>curator-x-rpc</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<name>Curator RPC Proxy</name>
<description>A proxy that bridges non-java environments with the Curator framework and recipes</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/09e9a55c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3f2d4f9..4fce651 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>pom</packaging>
<name>Apache Curator</name>
@@ -105,7 +105,7 @@
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git
</developerConnection>
- <tag>HEAD</tag>
+ <tag>apache-curator-2.7.1</tag>
</scm>
<issueManagement>
[31/50] curator git commit: ChildReaper now creates a leaderLatch
itself if a leader path is provided and does no work (such as passing paths
to its Reaper) if it is not currently the leader.
Posted by ca...@apache.org.
ChildReaper now creates a leaderLatch itself if a leader path is provided and does no work (such as passing paths to its Reaper) if it is not currently the leader.
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/49eb02a0
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/49eb02a0
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/49eb02a0
Branch: refs/heads/CURATOR-154
Commit: 49eb02a04f377a3b9e2da3b3904311ddddf1aa9d
Parents: 9da7960
Author: David Kesler <dk...@yodle.com>
Authored: Mon Feb 9 13:50:39 2015 -0500
Committer: David Kesler <dk...@yodle.com>
Committed: Mon Feb 9 13:50:39 2015 -0500
----------------------------------------------------------------------
.../framework/recipes/locks/ChildReaper.java | 56 ++++++++++++++------
.../recipes/locks/TestChildReaper.java | 47 ++++++++++++++++
2 files changed, 88 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/49eb02a0/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
index 6e0a7e4..56c56ab 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
@@ -20,6 +20,8 @@ package org.apache.curator.framework.recipes.locks;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
+
+import org.apache.curator.framework.recipes.leader.LeaderLatch;
import org.apache.curator.utils.CloseableUtils;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.utils.CloseableScheduledExecutorService;
@@ -52,6 +54,7 @@ public class ChildReaper implements Closeable
private final Reaper.Mode mode;
private final CloseableScheduledExecutorService executor;
private final int reapingThresholdMs;
+ private final LeaderLatch leaderLatch;
private volatile Future<?> task;
@@ -109,7 +112,15 @@ public class ChildReaper implements Closeable
this.mode = mode;
this.executor = new CloseableScheduledExecutorService(executor);
this.reapingThresholdMs = reapingThresholdMs;
- this.reaper = new Reaper(client, executor, reapingThresholdMs, leaderPath);
+ if (leaderPath != null)
+ {
+ leaderLatch = new LeaderLatch(client, leaderPath);
+ }
+ else
+ {
+ leaderLatch = null;
+ }
+ this.reaper = new Reaper(client, executor, reapingThresholdMs, leaderLatch);
addPath(path);
}
@@ -136,7 +147,10 @@ public class ChildReaper implements Closeable
reapingThresholdMs,
TimeUnit.MILLISECONDS
);
-
+ if (leaderLatch != null)
+ {
+ leaderLatch.start();
+ }
reaper.start();
}
@@ -146,6 +160,10 @@ public class ChildReaper implements Closeable
if ( state.compareAndSet(State.STARTED, State.CLOSED) )
{
CloseableUtils.closeQuietly(reaper);
+ if (leaderLatch != null)
+ {
+ CloseableUtils.closeQuietly(leaderLatch);
+ }
task.cancel(true);
}
}
@@ -173,32 +191,40 @@ public class ChildReaper implements Closeable
return paths.remove(PathUtils.validatePath(path));
}
- private static ScheduledExecutorService newExecutorService()
+ public static ScheduledExecutorService newExecutorService()
{
return ThreadUtils.newFixedThreadScheduledPool(2, "ChildReaper");
}
private void doWork()
{
- for ( String path : paths )
+ if (shouldDoWork())
{
- try
+ for ( String path : paths )
{
- List<String> children = client.getChildren().forPath(path);
- for ( String name : children )
+ try
{
- String thisPath = ZKPaths.makePath(path, name);
- Stat stat = client.checkExists().forPath(thisPath);
- if ( (stat != null) && (stat.getNumChildren() == 0) )
+ List<String> children = client.getChildren().forPath(path);
+ for ( String name : children )
{
- reaper.addPath(thisPath, mode);
+ String thisPath = ZKPaths.makePath(path, name);
+ Stat stat = client.checkExists().forPath(thisPath);
+ if ( (stat != null) && (stat.getNumChildren() == 0) )
+ {
+ reaper.addPath(thisPath, mode);
+ }
}
}
- }
- catch ( Exception e )
- {
- log.error("Could not get children for path: " + path, e);
+ catch ( Exception e )
+ {
+ log.error("Could not get children for path: " + path, e);
+ }
}
}
}
+
+ private boolean shouldDoWork()
+ {
+ return this.leaderLatch == null || this.leaderLatch.hasLeadership();
+ }
}
http://git-wip-us.apache.org/repos/asf/curator/blob/49eb02a0/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
index ad6ba6c..d81bb3a 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
@@ -18,6 +18,7 @@
*/
package org.apache.curator.framework.recipes.locks;
+import org.apache.curator.framework.recipes.leader.LeaderLatch;
import org.apache.curator.test.BaseClassForTests;
import org.apache.curator.utils.CloseableUtils;
import org.apache.curator.framework.CuratorFramework;
@@ -100,6 +101,52 @@ public class TestChildReaper extends BaseClassForTests
}
@Test
+ public void testLeaderElection() throws Exception
+ {
+ Timing timing = new Timing();
+ ChildReaper reaper = null;
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+ LeaderLatch otherLeader = null;
+ try
+ {
+ client.start();
+
+ for ( int i = 0; i < 10; ++i )
+ {
+ client.create().creatingParentsIfNeeded().forPath("/test/" + Integer.toString(i));
+ }
+
+ otherLeader = new LeaderLatch(client, "/test-leader");
+ otherLeader.start();
+
+ reaper = new ChildReaper(client, "/test", Reaper.Mode.REAP_UNTIL_DELETE, ChildReaper.newExecutorService(), 1, "/test-leader");
+ reaper.start();
+
+ timing.forWaiting().sleepABit();
+
+ //Should not have reaped anything at this point since otherLeader is still leader
+ Stat stat = client.checkExists().forPath("/test");
+ Assert.assertEquals(stat.getNumChildren(), 10);
+
+ CloseableUtils.closeQuietly(otherLeader);
+
+ timing.forWaiting().sleepABit();
+
+ stat = client.checkExists().forPath("/test");
+ Assert.assertEquals(stat.getNumChildren(), 0);
+ }
+ finally
+ {
+ CloseableUtils.closeQuietly(reaper);
+ if (otherLeader != null && otherLeader.getState() == LeaderLatch.State.STARTED)
+ {
+ CloseableUtils.closeQuietly(otherLeader);
+ }
+ CloseableUtils.closeQuietly(client);
+ }
+ }
+
+ @Test
public void testMultiPath() throws Exception
{
Timing timing = new Timing();
[34/50] curator git commit: Replacing LockSchema with simple
Set
Posted by ca...@apache.org.
Replacing LockSchema with simple Set<String>
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/aa3dff70
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/aa3dff70
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/aa3dff70
Branch: refs/heads/CURATOR-154
Commit: aa3dff70b2c895cd69a490d426afbdb7e6a9ae67
Parents: 72aea4a
Author: David Kesler <dk...@yodle.com>
Authored: Mon Mar 9 14:29:52 2015 -0400
Committer: David Kesler <dk...@yodle.com>
Committed: Mon Mar 9 14:29:52 2015 -0400
----------------------------------------------------------------------
.../framework/recipes/locks/ChildReaper.java | 10 +++++----
.../recipes/locks/InterProcessSemaphoreV2.java | 9 ++++----
.../framework/recipes/locks/LockSchema.java | 22 --------------------
3 files changed, 10 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/aa3dff70/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
index 7935f0b..6a2c05a 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
@@ -33,7 +33,9 @@ import org.slf4j.LoggerFactory;
import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -55,7 +57,7 @@ public class ChildReaper implements Closeable
private final CloseableScheduledExecutorService executor;
private final int reapingThresholdMs;
private final LeaderLatch leaderLatch;
- private final LockSchema lockSchema;
+ private final Set<String> lockSchema;
private volatile Future<?> task;
@@ -109,7 +111,7 @@ public class ChildReaper implements Closeable
*/
public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath)
{
- this(client, path, mode, executor, reapingThresholdMs, leaderPath, new LockSchema());
+ this(client, path, mode, executor, reapingThresholdMs, leaderPath, Collections.<String>emptySet());
}
@@ -122,7 +124,7 @@ public class ChildReaper implements Closeable
* @param leaderPath if not null, uses a leader selection so that only 1 reaper is active in the cluster
* @param lockSchema a set of the possible subnodes of the children of path that must be reaped in addition to the child nodes
*/
- public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath, LockSchema lockSchema)
+ public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath, Set<String> lockSchema)
{
this.client = client;
this.mode = mode;
@@ -226,7 +228,7 @@ public class ChildReaper implements Closeable
{
String childPath = ZKPaths.makePath(path, name);
addPathToReaperIfEmpty(childPath);
- for ( String subNode : lockSchema.getPaths() )
+ for ( String subNode : lockSchema )
{
addPathToReaperIfEmpty(ZKPaths.makePath(childPath, subNode));
}
http://git-wip-us.apache.org/repos/asf/curator/blob/aa3dff70/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
index 55647ad..b6d5ca2 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
@@ -42,6 +42,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.curator.utils.PathUtils;
@@ -94,11 +95,9 @@ public class InterProcessSemaphoreV2
private static final String LOCK_PARENT = "locks";
private static final String LEASE_PARENT = "leases";
private static final String LEASE_BASE_NAME = "lease-";
- public static final LockSchema LOCK_SCHEMA = new LockSchema(
- Sets.newHashSet(
- LOCK_PARENT,
- LEASE_PARENT
- )
+ public static final Set<String> LOCK_SCHEMA = Sets.newHashSet(
+ LOCK_PARENT,
+ LEASE_PARENT
);
/**
http://git-wip-us.apache.org/repos/asf/curator/blob/aa3dff70/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
deleted file mode 100644
index 5794705..0000000
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.apache.curator.framework.recipes.locks;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.google.common.collect.Sets;
-
-public class LockSchema {
- private final Set<String> paths;
-
- public LockSchema() {
- paths = new HashSet<String>();
- }
-
- public LockSchema(Set<String> paths) {
- this.paths = Sets.newHashSet(paths);
- }
-
- public Set<String> getPaths() {
- return Sets.newHashSet(paths);
- }
-}
[49/50] curator git commit: fixed license header
Posted by ca...@apache.org.
fixed license header
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c65e0914
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c65e0914
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c65e0914
Branch: refs/heads/CURATOR-154
Commit: c65e091417e1da2246203cb9b2cce82ecd87784f
Parents: 5b24948
Author: randgalt <ra...@apache.org>
Authored: Tue Apr 21 11:41:34 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Apr 21 11:41:34 2015 -0500
----------------------------------------------------------------------
.../curator/framework/recipes/locks/TestChildReaper.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/c65e0914/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
index 906d9d4..cafb9a3 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
@@ -6,9 +6,9 @@
* 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
+ * 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
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.curator.framework.recipes.locks;
import org.apache.curator.framework.CuratorFramework;
[35/50] curator git commit: Merge branch 'CURATOR-173'
Posted by ca...@apache.org.
Merge branch 'CURATOR-173'
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/67b122da
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/67b122da
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/67b122da
Branch: refs/heads/CURATOR-154
Commit: 67b122da508b1edbc3ccf31525db1da666fc0859
Parents: 49eb02a aa3dff7
Author: Scott Blum <dr...@apache.org>
Authored: Wed Mar 11 12:39:03 2015 -0400
Committer: Scott Blum <dr...@apache.org>
Committed: Wed Mar 11 12:39:50 2015 -0400
----------------------------------------------------------------------
.../framework/recipes/locks/ChildReaper.java | 37 ++++++++++++++++--
.../recipes/locks/InterProcessSemaphoreV2.java | 7 ++++
.../locks/TestInterProcessSemaphore.java | 40 ++++++++++++++++++++
3 files changed, 80 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
[07/50] curator git commit: Merge branch 'CURATOR-111' of
https://github.com/kambatla/curator into CURATOR-111
Posted by ca...@apache.org.
Merge branch 'CURATOR-111' of https://github.com/kambatla/curator into CURATOR-111
Conflicts:
curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/58ecd64f
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/58ecd64f
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/58ecd64f
Branch: refs/heads/CURATOR-154
Commit: 58ecd64f0b0b05590f2bcd350d17c173a5c791ab
Parents: 84699d3 71dc640
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 15:55:20 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 15:55:20 2015 -0500
----------------------------------------------------------------------
.../org/apache/curator/framework/AuthInfo.java | 51 ++++++++++++++++++++
.../framework/CuratorFrameworkFactory.java | 23 +++++++++
.../framework/imps/CuratorFrameworkImpl.java | 42 ++++++----------
.../curator/framework/imps/TestFramework.java | 44 +++++++++++++++++
4 files changed, 132 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/58ecd64f/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/58ecd64f/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --cc curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index fc462d4,f7b08a6..c38617d
--- 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
@@@ -60,60 -60,36 +63,39 @@@ import java.util.concurrent.atomic.Atom
public class CuratorFrameworkImpl implements CuratorFramework
{
-
- private final Logger log = LoggerFactory.getLogger(getClass());
- private final CuratorZookeeperClient client;
- private final ListenerContainer<CuratorListener> listeners;
- private final ListenerContainer<UnhandledErrorListener> unhandledErrorListeners;
- private final ThreadFactory threadFactory;
- private final BlockingQueue<OperationAndData<?>> backgroundOperations;
- private final NamespaceImpl namespace;
- private final ConnectionStateManager connectionStateManager;
- private final List<AuthInfo> authInfos;
- private final byte[] defaultData;
- private final FailedDeleteManager failedDeleteManager;
- private final CompressionProvider compressionProvider;
- private final ACLProvider aclProvider;
- private final NamespaceFacadeCache namespaceFacadeCache;
- private final NamespaceWatcherMap namespaceWatcherMap = new NamespaceWatcherMap(this);
-
- private volatile ExecutorService executorService;
- private final AtomicBoolean logAsErrorConnectionErrors = new AtomicBoolean(false);
-
- private static final boolean LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL = !Boolean.getBoolean(DebugUtils.PROPERTY_LOG_ONLY_FIRST_CONNECTION_ISSUE_AS_ERROR_LEVEL);
+ private final Logger log = LoggerFactory.getLogger(getClass());
+ private final CuratorZookeeperClient client;
+ private final ListenerContainer<CuratorListener> listeners;
+ private final ListenerContainer<UnhandledErrorListener> unhandledErrorListeners;
+ private final ThreadFactory threadFactory;
+ private final int maxCloseWaitMs;
+ private final BlockingQueue<OperationAndData<?>> backgroundOperations;
+ private final NamespaceImpl namespace;
+ private final ConnectionStateManager connectionStateManager;
- private final AtomicReference<AuthInfo> authInfo = new AtomicReference<AuthInfo>();
++ private final List<AuthInfo> authInfos;
+ private final byte[] defaultData;
+ private final FailedDeleteManager failedDeleteManager;
+ private final CompressionProvider compressionProvider;
+ private final ACLProvider aclProvider;
+ private final NamespaceFacadeCache namespaceFacadeCache;
+ private final NamespaceWatcherMap namespaceWatcherMap = new NamespaceWatcherMap(this);
+
+ private volatile ExecutorService executorService;
+ private final AtomicBoolean logAsErrorConnectionErrors = new AtomicBoolean(false);
+
+ private static final boolean LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL = !Boolean.getBoolean(DebugUtils.PROPERTY_LOG_ONLY_FIRST_CONNECTION_ISSUE_AS_ERROR_LEVEL);
interface DebugBackgroundListener
{
- void listen(OperationAndData<?> data);
+ void listen(OperationAndData<?> data);
}
- volatile DebugBackgroundListener debugListener = null;
- private final AtomicReference<CuratorFrameworkState> state;
+ volatile DebugBackgroundListener debugListener = null;
+ @VisibleForTesting
+ public volatile UnhandledErrorListener debugUnhandledErrorListener = null;
+
+ private final AtomicReference<CuratorFrameworkState> state;
- private static class AuthInfo
- {
- final String scheme;
- final byte[] auth;
-
- private AuthInfo(String scheme, byte[] auth)
- {
- this.scheme = scheme;
- this.auth = auth;
- }
-
- @Override
- public String toString()
- {
- return "AuthInfo{" +
- "scheme='" + scheme + '\'' +
- ", auth=" + Arrays.toString(auth) +
- '}';
- }
- }
-
public CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder)
{
ZookeeperFactory localZookeeperFactory = makeZookeeperFactory(builder.getZookeeperFactory());
@@@ -138,12 -135,17 +120,17 @@@
aclProvider = builder.getAclProvider();
state = new AtomicReference<CuratorFrameworkState>(CuratorFrameworkState.LATENT);
- byte[] builderDefaultData = builder.getDefaultData();
+ byte[] builderDefaultData = builder.getDefaultData();
defaultData = (builderDefaultData != null) ? Arrays.copyOf(builderDefaultData, builderDefaultData.length) : new byte[0];
+ authInfos = new ArrayList<AuthInfo>();
if ( builder.getAuthScheme() != null )
{
- authInfo.set(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue()));
+ authInfos.add(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue()));
+ }
+ if ( builder.getAuthInfos() != null )
+ {
+ authInfos.addAll(builder.getAuthInfos());
}
failedDeleteManager = new FailedDeleteManager(this);
@@@ -238,8 -226,9 +225,7 @@@
log.info("Starting");
if ( !state.compareAndSet(CuratorFrameworkState.LATENT, CuratorFrameworkState.STARTED) )
{
- IllegalStateException ise = new IllegalStateException("Cannot be started more than once");
- throw ise;
- IllegalStateException error = new IllegalStateException();
- log.error("Cannot be started more than once", error);
- throw error;
++ throw new IllegalStateException("Cannot be started more than once");
}
try
http://git-wip-us.apache.org/repos/asf/curator/blob/58ecd64f/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
diff --cc curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index 5a640db,0f51b25..c98dd0f
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@@ -19,6 -19,9 +19,7 @@@
package org.apache.curator.framework.imps;
import com.google.common.collect.Lists;
+ import org.apache.curator.framework.AuthInfo;
-import org.apache.curator.test.BaseClassForTests;
-import org.apache.curator.utils.CloseableUtils;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.api.BackgroundCallback;
@@@ -41,6 -43,8 +42,7 @@@ import org.apache.zookeeper.data.ACL
import org.apache.zookeeper.data.Stat;
import org.testng.Assert;
import org.testng.annotations.Test;
-
+ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
[21/50] curator git commit: back to 2.7.1-SNAPSHOT due to bad build
Posted by ca...@apache.org.
back to 2.7.1-SNAPSHOT due to bad build
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/34bd3e8f
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/34bd3e8f
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/34bd3e8f
Branch: refs/heads/CURATOR-154
Commit: 34bd3e8f39a5d07cd5a024c6375491080e36ff05
Parents: 5ded39f
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 13 07:50:36 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jan 13 07:50:36 2015 -0500
----------------------------------------------------------------------
curator-client/pom.xml | 4 ++--
curator-examples/pom.xml | 2 +-
curator-framework/pom.xml | 4 ++--
curator-recipes/pom.xml | 4 ++--
curator-test/pom.xml | 4 ++--
curator-x-discovery-server/pom.xml | 4 ++--
curator-x-discovery/pom.xml | 4 ++--
curator-x-rpc/pom.xml | 4 ++--
pom.xml | 2 +-
9 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index 251d2b0..cd0af80 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-client</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Client</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index 96ea4b1..1728ec9 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-examples</artifactId>
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index 67f514f..446c2fd 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-framework</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Framework</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 3ce7d63..4955dde 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-recipes</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Recipes</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 153db7b..5b6352a 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-test</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<name>Curator Testing</name>
<description>Unit testing utilities.</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index 6035681..f6851be 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery-server</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery Server</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index b557211..69d8410 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 372869d..0e0b528 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>apache-curator</artifactId>
<groupId>org.apache.curator</groupId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>curator-x-rpc</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<name>Curator RPC Proxy</name>
<description>A proxy that bridges non-java environments with the Curator framework and recipes</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/34bd3e8f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index be3ea33..3f2d4f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache Curator</name>
[06/50] curator git commit: eliminated warning
Posted by ca...@apache.org.
eliminated warning
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/84699d33
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/84699d33
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/84699d33
Branch: refs/heads/CURATOR-154
Commit: 84699d336fa96f78cbeca25b159091acd95384df
Parents: 687672a
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 15:49:19 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 15:49:19 2015 -0500
----------------------------------------------------------------------
.../src/test/java/org/apache/curator/utils/TestZKPaths.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/84699d33/curator-client/src/test/java/org/apache/curator/utils/TestZKPaths.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/utils/TestZKPaths.java b/curator-client/src/test/java/org/apache/curator/utils/TestZKPaths.java
index 2e8dc73..ef05d34 100644
--- a/curator-client/src/test/java/org/apache/curator/utils/TestZKPaths.java
+++ b/curator-client/src/test/java/org/apache/curator/utils/TestZKPaths.java
@@ -26,6 +26,7 @@ import java.util.Collections;
public class TestZKPaths
{
+ @SuppressWarnings("NullArgumentToVariableArgMethod")
@Test
public void testMakePath()
{
[08/50] curator git commit: Use Guava
Posted by ca...@apache.org.
Use Guava
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/7fc3e650
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/7fc3e650
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/7fc3e650
Branch: refs/heads/CURATOR-154
Commit: 7fc3e6507d5bcbb16c696906bed529c23df88e34
Parents: 58ecd64
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 16:03:35 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 16:03:35 2015 -0500
----------------------------------------------------------------------
.../framework/CuratorFrameworkFactory.java | 73 +++++++++----------
.../framework/imps/CuratorFrameworkImpl.java | 77 ++++++++++----------
2 files changed, 76 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/7fc3e650/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 38fe911..ae26f2c 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
@@ -16,8 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.curator.framework;
+import com.google.common.collect.ImmutableList;
import org.apache.curator.RetryPolicy;
import org.apache.curator.ensemble.EnsembleProvider;
import org.apache.curator.ensemble.fixed.FixedEnsembleProvider;
@@ -34,7 +36,6 @@ import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ThreadFactory;
@@ -45,23 +46,23 @@ import java.util.concurrent.TimeUnit;
*/
public class CuratorFrameworkFactory
{
- private static final int DEFAULT_SESSION_TIMEOUT_MS = Integer.getInteger("curator-default-session-timeout", 60 * 1000);
- private static final int DEFAULT_CONNECTION_TIMEOUT_MS = Integer.getInteger("curator-default-connection-timeout", 15 * 1000);
+ private static final int DEFAULT_SESSION_TIMEOUT_MS = Integer.getInteger("curator-default-session-timeout", 60 * 1000);
+ private static final int DEFAULT_CONNECTION_TIMEOUT_MS = Integer.getInteger("curator-default-connection-timeout", 15 * 1000);
- private static final byte[] LOCAL_ADDRESS = getLocalAddress();
+ private static final byte[] LOCAL_ADDRESS = getLocalAddress();
- private static final CompressionProvider DEFAULT_COMPRESSION_PROVIDER = new GzipCompressionProvider();
- private static final DefaultZookeeperFactory DEFAULT_ZOOKEEPER_FACTORY = new DefaultZookeeperFactory();
- private static final DefaultACLProvider DEFAULT_ACL_PROVIDER = new DefaultACLProvider();
- private static final long DEFAULT_INACTIVE_THRESHOLD_MS = (int)TimeUnit.MINUTES.toMillis(3);
- private static final int DEFAULT_CLOSE_WAIT_MS = (int)TimeUnit.SECONDS.toMillis(1);
+ private static final CompressionProvider DEFAULT_COMPRESSION_PROVIDER = new GzipCompressionProvider();
+ private static final DefaultZookeeperFactory DEFAULT_ZOOKEEPER_FACTORY = new DefaultZookeeperFactory();
+ private static final DefaultACLProvider DEFAULT_ACL_PROVIDER = new DefaultACLProvider();
+ private static final long DEFAULT_INACTIVE_THRESHOLD_MS = (int)TimeUnit.MINUTES.toMillis(3);
+ private static final int DEFAULT_CLOSE_WAIT_MS = (int)TimeUnit.SECONDS.toMillis(1);
/**
* Return a new builder that builds a CuratorFramework
*
* @return new builder
*/
- public static Builder builder()
+ public static Builder builder()
{
return new Builder();
}
@@ -69,9 +70,8 @@ public class CuratorFrameworkFactory
/**
* Create a new client with default session timeout and default connection timeout
*
- *
* @param connectString list of servers to connect to
- * @param retryPolicy retry policy to use
+ * @param retryPolicy retry policy to use
* @return client
*/
public static CuratorFramework newClient(String connectString, RetryPolicy retryPolicy)
@@ -82,11 +82,10 @@ public class CuratorFrameworkFactory
/**
* Create a new client
*
- *
- * @param connectString list of servers to connect to
- * @param sessionTimeoutMs session timeout
+ * @param connectString list of servers to connect to
+ * @param sessionTimeoutMs session timeout
* @param connectionTimeoutMs connection timeout
- * @param retryPolicy retry policy to use
+ * @param retryPolicy retry policy to use
* @return client
*/
public static CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy)
@@ -101,21 +100,21 @@ public class CuratorFrameworkFactory
public static class Builder
{
- private EnsembleProvider ensembleProvider;
- private int sessionTimeoutMs = DEFAULT_SESSION_TIMEOUT_MS;
- private int connectionTimeoutMs = DEFAULT_CONNECTION_TIMEOUT_MS;
- private int maxCloseWaitMs = DEFAULT_CLOSE_WAIT_MS;
- private RetryPolicy retryPolicy;
- private ThreadFactory threadFactory = null;
- private String namespace;
- private String authScheme = null;
- private byte[] authValue = null;
- private List<AuthInfo> authInfos = null;
- private byte[] defaultData = LOCAL_ADDRESS;
+ private EnsembleProvider ensembleProvider;
+ private int sessionTimeoutMs = DEFAULT_SESSION_TIMEOUT_MS;
+ private int connectionTimeoutMs = DEFAULT_CONNECTION_TIMEOUT_MS;
+ private int maxCloseWaitMs = DEFAULT_CLOSE_WAIT_MS;
+ private RetryPolicy retryPolicy;
+ private ThreadFactory threadFactory = null;
+ private String namespace;
+ private String authScheme = null;
+ private byte[] authValue = null;
+ private List<AuthInfo> authInfos = null;
+ private byte[] defaultData = LOCAL_ADDRESS;
private CompressionProvider compressionProvider = DEFAULT_COMPRESSION_PROVIDER;
- private ZookeeperFactory zookeeperFactory = DEFAULT_ZOOKEEPER_FACTORY;
- private ACLProvider aclProvider = DEFAULT_ACL_PROVIDER;
- private boolean canBeReadOnly = false;
+ private ZookeeperFactory zookeeperFactory = DEFAULT_ZOOKEEPER_FACTORY;
+ private ACLProvider aclProvider = DEFAULT_ACL_PROVIDER;
+ private boolean canBeReadOnly = false;
/**
* Apply the current values and build a new CuratorFramework
@@ -147,7 +146,7 @@ public class CuratorFrameworkFactory
* are limited. Further, the connection will be closed after <code>inactiveThresholdMs</code> milliseconds of inactivity.
*
* @param inactiveThreshold number of milliseconds of inactivity to cause connection close
- * @param unit threshold unit
+ * @param unit threshold unit
* @return temp instance
*/
public CuratorTempFramework buildTemp(long inactiveThreshold, TimeUnit unit)
@@ -159,10 +158,10 @@ public class CuratorFrameworkFactory
* Add connection authorization
*
* @param scheme the scheme
- * @param auth the auth bytes
+ * @param auth the auth bytes
* @return this
*/
- public Builder authorization(String scheme, byte[] auth)
+ public Builder authorization(String scheme, byte[] auth)
{
this.authScheme = scheme;
this.authValue = (auth != null) ? Arrays.copyOf(auth, auth.length) : null;
@@ -172,15 +171,15 @@ public class CuratorFrameworkFactory
/**
* Add connection authorization. The supplied authInfos are appended to those added via call to
* {@link #authorization(java.lang.String, byte[])} for backward compatibility.
- *
+ * <p/>
* Subsequent calls to this method overwrite the prior calls.
*
* @param authInfos list of {@link AuthInfo} objects with scheme and auth
* @return this
*/
- public Builder authorization(List<AuthInfo> authInfos) {
- this.authInfos = new ArrayList<AuthInfo>(authInfos.size());
- this.authInfos.addAll(authInfos);
+ public Builder authorization(List<AuthInfo> authInfos)
+ {
+ this.authInfos = ImmutableList.copyOf(authInfos);
return this;
}
http://git-wip-us.apache.org/repos/asf/curator/blob/7fc3e650/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 c38617d..e8785be 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
@@ -22,7 +22,7 @@ package org.apache.curator.framework.imps;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
-
+import com.google.common.collect.ImmutableList;
import org.apache.curator.CuratorConnectionLossException;
import org.apache.curator.CuratorZookeeperClient;
import org.apache.curator.RetryLoop;
@@ -47,8 +47,6 @@ import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.BlockingQueue;
@@ -122,19 +120,24 @@ public class CuratorFrameworkImpl implements CuratorFramework
byte[] builderDefaultData = builder.getDefaultData();
defaultData = (builderDefaultData != null) ? Arrays.copyOf(builderDefaultData, builderDefaultData.length) : new byte[0];
+ authInfos = buildAuths(builder);
- authInfos = new ArrayList<AuthInfo>();
+ failedDeleteManager = new FailedDeleteManager(this);
+ namespaceFacadeCache = new NamespaceFacadeCache(this);
+ }
+
+ private List<AuthInfo> buildAuths(CuratorFrameworkFactory.Builder builder)
+ {
+ ImmutableList.Builder<AuthInfo> builder1 = ImmutableList.builder();
if ( builder.getAuthScheme() != null )
{
- authInfos.add(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue()));
+ builder1.add(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue()));
}
if ( builder.getAuthInfos() != null )
{
- authInfos.addAll(builder.getAuthInfos());
+ builder1.addAll(builder.getAuthInfos());
}
-
- failedDeleteManager = new FailedDeleteManager(this);
- namespaceFacadeCache = new NamespaceFacadeCache(this);
+ return builder1.build();
}
private ZookeeperFactory makeZookeeperFactory(final ZookeeperFactory actualZookeeperFactory)
@@ -145,7 +148,7 @@ public class CuratorFrameworkImpl implements CuratorFramework
public ZooKeeper newZooKeeper(String connectString, int sessionTimeout, Watcher watcher, boolean canBeReadOnly) throws Exception
{
ZooKeeper zooKeeper = actualZookeeperFactory.newZooKeeper(connectString, sessionTimeout, watcher, canBeReadOnly);
- for (AuthInfo auth : authInfos)
+ for ( AuthInfo auth : authInfos )
{
zooKeeper.addAuthInfo(auth.getScheme(), auth.getAuth());
}
@@ -251,14 +254,14 @@ public class CuratorFrameworkImpl implements CuratorFramework
executorService = Executors.newFixedThreadPool(2, threadFactory); // 1 for listeners, 1 for background ops
executorService.submit(new Callable<Object>()
+ {
+ @Override
+ public Object call() throws Exception
{
- @Override
- public Object call() throws Exception
- {
- backgroundOperationsLoop();
- return null;
- }
- });
+ backgroundOperationsLoop();
+ return null;
+ }
+ });
}
catch ( Exception e )
{
@@ -273,22 +276,22 @@ public class CuratorFrameworkImpl implements CuratorFramework
if ( state.compareAndSet(CuratorFrameworkState.STARTED, CuratorFrameworkState.STOPPED) )
{
listeners.forEach(new Function<CuratorListener, Void>()
+ {
+ @Override
+ public Void apply(CuratorListener listener)
{
- @Override
- public Void apply(CuratorListener listener)
+ CuratorEvent event = new CuratorEventImpl(CuratorFrameworkImpl.this, CuratorEventType.CLOSING, 0, null, null, null, null, null, null, null, null);
+ try
{
- CuratorEvent event = new CuratorEventImpl(CuratorFrameworkImpl.this, CuratorEventType.CLOSING, 0, null, null, null, null, null, null, null, null);
- try
- {
- listener.eventReceived(CuratorFrameworkImpl.this, event);
- }
- catch ( Exception e )
- {
- log.error("Exception while sending Closing event", e);
- }
- return null;
+ listener.eventReceived(CuratorFrameworkImpl.this, event);
}
- });
+ catch ( Exception e )
+ {
+ log.error("Exception while sending Closing event", e);
+ }
+ return null;
+ }
+ });
if ( executorService != null )
{
@@ -550,14 +553,14 @@ public class CuratorFrameworkImpl implements CuratorFramework
final String localReason = reason;
unhandledErrorListeners.forEach(new Function<UnhandledErrorListener, Void>()
+ {
+ @Override
+ public Void apply(UnhandledErrorListener listener)
{
- @Override
- public Void apply(UnhandledErrorListener listener)
- {
- listener.unhandledError(localReason, e);
- return null;
- }
- });
+ listener.unhandledError(localReason, e);
+ return null;
+ }
+ });
if ( debugUnhandledErrorListener != null )
{
[04/50] curator git commit: remove duplicate
Posted by ca...@apache.org.
remove duplicate
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/7a97315d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/7a97315d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/7a97315d
Branch: refs/heads/CURATOR-154
Commit: 7a97315dd264a61cb3ea8c02b484cf744e39298c
Parents: f2f03ce
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 15:30:43 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 15:30:43 2015 -0500
----------------------------------------------------------------------
.../x/discovery/TestServiceDiscovery.java | 34 --------------------
1 file changed, 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/7a97315d/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
index 4a586b4..6eb9ebb 100644
--- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
+++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
@@ -297,38 +297,4 @@ public class TestServiceDiscovery extends BaseClassForTests
}
}
}
-
- @Test
- public void testNoServerOnStart() throws Exception
- {
- server.stop();
- List<Closeable> closeables = Lists.newArrayList();
- try
- {
- CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
- closeables.add(client);
- client.start();
-
- ServiceInstance<String> instance = ServiceInstance.<String>builder().payload("thing").name("test").port(10064).build();
- ServiceDiscovery<String> discovery = ServiceDiscoveryBuilder.builder(String.class).basePath("/test").client(client).thisInstance(instance).build();
- closeables.add(discovery);
- discovery.start();
-
- server.restart();
- Assert.assertEquals(discovery.queryForNames(), Arrays.asList("test"));
-
- List<ServiceInstance<String>> list = Lists.newArrayList();
- list.add(instance);
- Assert.assertEquals(discovery.queryForInstances("test"), list);
- }
- finally
- {
- Collections.reverse(closeables);
- for ( Closeable c : closeables )
- {
- CloseableUtils.closeQuietly(c);
- }
- }
- }
-
}
[17/50] curator git commit: CURATOR-111 - Modified the authorization
handling so that the underlying auth data is stored in a single list.
Modified tests to have both a single auth and multiple auth case.
Posted by ca...@apache.org.
CURATOR-111 - Modified the authorization handling so that the underlying
auth data is stored in a single list. Modified tests to have both a single
auth and multiple auth case.
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/58328915
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/58328915
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/58328915
Branch: refs/heads/CURATOR-154
Commit: 58328915a6e005bc4171bb866cb2eba4762c3718
Parents: 7fc3e65
Author: Cameron McKenzie <ca...@unico.com.au>
Authored: Tue Jan 13 16:42:59 2015 +1100
Committer: Cameron McKenzie <ca...@unico.com.au>
Committed: Tue Jan 13 16:42:59 2015 +1100
----------------------------------------------------------------------
.../framework/CuratorFrameworkFactory.java | 21 ++----
.../framework/imps/CuratorFrameworkImpl.java | 4 --
.../curator/framework/imps/TestFramework.java | 73 +++++++++++++++-----
3 files changed, 64 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/58328915/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 ae26f2c..314d669 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
@@ -20,6 +20,8 @@
package org.apache.curator.framework;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+
import org.apache.curator.RetryPolicy;
import org.apache.curator.ensemble.EnsembleProvider;
import org.apache.curator.ensemble.fixed.FixedEnsembleProvider;
@@ -34,6 +36,7 @@ import org.apache.curator.utils.DefaultZookeeperFactory;
import org.apache.curator.utils.ZookeeperFactory;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
+
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -107,8 +110,6 @@ public class CuratorFrameworkFactory
private RetryPolicy retryPolicy;
private ThreadFactory threadFactory = null;
private String namespace;
- private String authScheme = null;
- private byte[] authValue = null;
private List<AuthInfo> authInfos = null;
private byte[] defaultData = LOCAL_ADDRESS;
private CompressionProvider compressionProvider = DEFAULT_COMPRESSION_PROVIDER;
@@ -156,6 +157,8 @@ public class CuratorFrameworkFactory
/**
* Add connection authorization
+ *
+ * Subsequent calls to this method overwrite the prior calls.
*
* @param scheme the scheme
* @param auth the auth bytes
@@ -163,8 +166,8 @@ public class CuratorFrameworkFactory
*/
public Builder authorization(String scheme, byte[] auth)
{
- this.authScheme = scheme;
- this.authValue = (auth != null) ? Arrays.copyOf(auth, auth.length) : null;
+ this.authInfos = Lists.newArrayList();
+ this.authInfos.add(new AuthInfo(scheme, (auth != null) ? Arrays.copyOf(auth, auth.length) : null));
return this;
}
@@ -380,16 +383,6 @@ public class CuratorFrameworkFactory
return namespace;
}
- public String getAuthScheme()
- {
- return authScheme;
- }
-
- public byte[] getAuthValue()
- {
- return (authValue != null) ? Arrays.copyOf(authValue, authValue.length) : null;
- }
-
public List<AuthInfo> getAuthInfos()
{
return authInfos;
http://git-wip-us.apache.org/repos/asf/curator/blob/58328915/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 e8785be..d4d902a 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
@@ -129,10 +129,6 @@ public class CuratorFrameworkImpl implements CuratorFramework
private List<AuthInfo> buildAuths(CuratorFrameworkFactory.Builder builder)
{
ImmutableList.Builder<AuthInfo> builder1 = ImmutableList.builder();
- if ( builder.getAuthScheme() != null )
- {
- builder1.add(new AuthInfo(builder.getAuthScheme(), builder.getAuthValue()));
- }
if ( builder.getAuthInfos() != null )
{
builder1.addAll(builder.getAuthInfos());
http://git-wip-us.apache.org/repos/asf/curator/blob/58328915/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index c98dd0f..6646a57 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -19,6 +19,7 @@
package org.apache.curator.framework.imps;
import com.google.common.collect.Lists;
+
import org.apache.curator.framework.AuthInfo;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
@@ -42,6 +43,7 @@ import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import org.testng.Assert;
import org.testng.annotations.Test;
+
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
@@ -168,18 +170,12 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testCreateACL() throws Exception
+ public void testCreateACLSingleAuth() throws Exception
{
- // Add a few authInfos
- List<AuthInfo> authInfos = new ArrayList<AuthInfo>();
- authInfos.add(new AuthInfo("digest", "me1:pass1".getBytes()));
- authInfos.add(new AuthInfo("digest", "me2:pass2".getBytes()));
-
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder
.connectString(server.getConnectString())
- .authorization("digest", "me:pass".getBytes())
- .authorization(authInfos)
+ .authorization("digest", "me1:pass1".getBytes())
.retryPolicy(new RetryOneTime(1))
.build();
client.start();
@@ -190,10 +186,10 @@ public class TestFramework extends BaseClassForTests
client.create().withACL(aclList).forPath("/test", "test".getBytes());
client.close();
- // Try setting data with me:pass
+ // Try setting data with me1:pass1
client = builder
.connectString(server.getConnectString())
- .authorization("digest", "me:pass".getBytes())
+ .authorization("digest", "me1:pass1".getBytes())
.retryPolicy(new RetryOneTime(1))
.build();
client.start();
@@ -207,12 +203,57 @@ public class TestFramework extends BaseClassForTests
}
client.close();
+ // Try setting data with something:else
+ client = builder
+ .connectString(server.getConnectString())
+ .authorization("digest", "something:else".getBytes())
+ .retryPolicy(new RetryOneTime(1))
+ .build();
+ client.start();
+ try
+ {
+ client.setData().forPath("/test", "test".getBytes());
+ Assert.fail("Should have failed with auth exception");
+ }
+ catch ( KeeperException.NoAuthException e )
+ {
+ // expected
+ }
+ }
+ finally
+ {
+ client.close();
+ }
+ }
+
+ @Test
+ public void testCreateACLMultipleAuths() throws Exception
+ {
+ // Add a few authInfos
+ List<AuthInfo> authInfos = new ArrayList<AuthInfo>();
+ authInfos.add(new AuthInfo("digest", "me1:pass1".getBytes()));
+ authInfos.add(new AuthInfo("digest", "me2:pass2".getBytes()));
+
+ CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
+ CuratorFramework client = builder
+ .connectString(server.getConnectString())
+ .authorization(authInfos)
+ .retryPolicy(new RetryOneTime(1))
+ .build();
+ client.start();
+ try
+ {
+ ACL acl = new ACL(ZooDefs.Perms.WRITE, ZooDefs.Ids.AUTH_IDS);
+ List<ACL> aclList = Lists.newArrayList(acl);
+ client.create().withACL(aclList).forPath("/test", "test".getBytes());
+ client.close();
+
// Try setting data with me1:pass1
client = builder
- .connectString(server.getConnectString())
- .authorization("digest", "me1:pass1".getBytes())
- .retryPolicy(new RetryOneTime(1))
- .build();
+ .connectString(server.getConnectString())
+ .authorization("digest", "me1:pass1".getBytes())
+ .retryPolicy(new RetryOneTime(1))
+ .build();
client.start();
try
{
@@ -224,10 +265,10 @@ public class TestFramework extends BaseClassForTests
}
client.close();
- // Try setting data with me2:pass2
+ // Try setting data with me1:pass1
client = builder
.connectString(server.getConnectString())
- .authorization("digest", "me:pass2".getBytes())
+ .authorization("digest", "me2:pass2".getBytes())
.retryPolicy(new RetryOneTime(1))
.build();
client.start();
[40/50] curator git commit: CURATOR-204 Update parent pom to apache:16
Posted by ca...@apache.org.
CURATOR-204 Update parent pom to apache:16
Update parent pom to apache 16 and remove duplicative version declarations. Let apache handle it where we don't conflict.
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6f505c2d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6f505c2d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6f505c2d
Branch: refs/heads/CURATOR-154
Commit: 6f505c2d58f46e4861761f2025b82f850b972c8a
Parents: 6a56c51
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Apr 7 14:22:41 2015 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Tue Apr 7 14:22:41 2015 -0500
----------------------------------------------------------------------
pom.xml | 60 +-----------------------------------------------------------
1 file changed, 1 insertion(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/6f505c2d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index be3ea33..3053832 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>14</version>
+ <version>16</version>
</parent>
<groupId>org.apache.curator</groupId>
@@ -62,18 +62,9 @@
<!-- versions -->
<maven-project-info-reports-plugin-version>2.7</maven-project-info-reports-plugin-version>
- <maven-javadoc-plugin-version>2.9.1</maven-javadoc-plugin-version>
- <maven-dependency-plugin-version>2.8</maven-dependency-plugin-version>
- <maven-install-plugin-version>2.5.1</maven-install-plugin-version>
- <maven-compiler-plugin-version>3.1</maven-compiler-plugin-version>
<maven-bundle-plugin-version>2.3.7</maven-bundle-plugin-version>
- <maven-surefire-plugin-version>2.17</maven-surefire-plugin-version>
- <maven-site-plugin-version>3.3</maven-site-plugin-version>
<doxia-module-confluence-version>1.5</doxia-module-confluence-version>
- <maven-scm-publish-plugin-version>1.0</maven-scm-publish-plugin-version>
<maven-license-plugin-version>1.9.0</maven-license-plugin-version>
- <maven-release-plugin-version>2.5</maven-release-plugin-version>
- <apache-rat-plugin-version>0.10</apache-rat-plugin-version>
<javassist-version>3.18.1-GA</javassist-version>
<commons-math-version>2.2</commons-math-version>
<jackson-mapper-asl-version>1.9.13</jackson-mapper-asl-version>
@@ -531,54 +522,12 @@
<pluginManagement>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>${maven-dependency-plugin-version}</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>${maven-install-plugin-version}</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin-version}</version>
- </plugin>
-
- <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin-version}</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${maven-surefire-plugin-version}</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>${maven-javadoc-plugin-version}</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>${maven-site-plugin-version}</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-scm-publish-plugin</artifactId>
- <version>${maven-scm-publish-plugin-version}</version>
- </plugin>
-
- <plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>${maven-license-plugin-version}</version>
@@ -587,7 +536,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
- <version>${maven-release-plugin-version}</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>${project.artifactId}-${project.version}</tagNameFormat>
@@ -597,12 +545,6 @@
</plugin>
<plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <version>${apache-rat-plugin-version}</version>
- </plugin>
-
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin-version}</version>
[45/50] curator git commit: fixed bad license headers
Posted by ca...@apache.org.
fixed bad license headers
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/2db9a6df
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/2db9a6df
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/2db9a6df
Branch: refs/heads/CURATOR-154
Commit: 2db9a6df95b8dcbe17de64fb89100bd3b7a5469b
Parents: c805679
Author: randgalt <ra...@apache.org>
Authored: Mon Apr 20 21:19:38 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Apr 20 21:19:38 2015 -0500
----------------------------------------------------------------------
.../java/org/apache/curator/framework/imps/TestFramework.java | 7 +++----
.../org/apache/curator/framework/imps/TestFrameworkEdges.java | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/2db9a6df/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index 22276e6..a1d9a8f 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -6,9 +6,9 @@
* 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
+ * 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
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.curator.framework.imps;
import com.google.common.collect.Lists;
http://git-wip-us.apache.org/repos/asf/curator/blob/2db9a6df/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
index af7ae2b..d9ef8d7 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
@@ -6,9 +6,9 @@
* 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
+ * 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
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.curator.framework.imps;
import com.google.common.collect.Queues;
[12/50] curator git commit: [maven-release-plugin] prepare release
apache-curator-2.7.1
Posted by ca...@apache.org.
[maven-release-plugin] prepare release apache-curator-2.7.1
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c2490532
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c2490532
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c2490532
Branch: refs/heads/CURATOR-154
Commit: c24905328b4b6d7b6fe6536ed017a584a9e6e2e0
Parents: b8715ca
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 21:35:19 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 21:35:19 2015 -0500
----------------------------------------------------------------------
curator-client/pom.xml | 4 ++--
curator-examples/pom.xml | 2 +-
curator-framework/pom.xml | 4 ++--
curator-recipes/pom.xml | 4 ++--
curator-test/pom.xml | 4 ++--
curator-x-discovery-server/pom.xml | 4 ++--
curator-x-discovery/pom.xml | 4 ++--
curator-x-rpc/pom.xml | 4 ++--
pom.xml | 4 ++--
9 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index cd0af80..b21ab7e 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-client</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Client</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index 1728ec9..8a55dc0 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-examples</artifactId>
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index 446c2fd..f5b309d 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-framework</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Framework</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 4955dde..348cc48 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-recipes</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Recipes</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 5b6352a..67bac8c 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-test</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<name>Curator Testing</name>
<description>Unit testing utilities.</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index f6851be..fcbbafa 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-x-discovery-server</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery Server</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index 69d8410..1688ae2 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-x-discovery</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 0e0b528..749deea 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>apache-curator</artifactId>
<groupId>org.apache.curator</groupId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>curator-x-rpc</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<name>Curator RPC Proxy</name>
<description>A proxy that bridges non-java environments with the Curator framework and recipes</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/c2490532/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3f2d4f9..4fce651 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>pom</packaging>
<name>Apache Curator</name>
@@ -105,7 +105,7 @@
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git
</developerConnection>
- <tag>HEAD</tag>
+ <tag>apache-curator-2.7.1</tag>
</scm>
<issueManagement>
[24/50] curator git commit: [maven-release-plugin] prepare for next
development iteration
Posted by ca...@apache.org.
[maven-release-plugin] prepare for next development iteration
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/fd5a00c4
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/fd5a00c4
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/fd5a00c4
Branch: refs/heads/CURATOR-154
Commit: fd5a00c419d4a70b6dbe197959fd0e039b5fef28
Parents: 09e9a55
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 13 08:30:39 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jan 13 08:30:39 2015 -0500
----------------------------------------------------------------------
curator-client/pom.xml | 4 ++--
curator-examples/pom.xml | 2 +-
curator-framework/pom.xml | 4 ++--
curator-recipes/pom.xml | 4 ++--
curator-test/pom.xml | 4 ++--
curator-x-discovery-server/pom.xml | 4 ++--
curator-x-discovery/pom.xml | 4 ++--
curator-x-rpc/pom.xml | 4 ++--
pom.xml | 4 ++--
9 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index b21ab7e..251d2b0 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-client</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Client</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index 8a55dc0..96ea4b1 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-examples</artifactId>
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index f5b309d..67f514f 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-framework</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Framework</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 348cc48..3ce7d63 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-recipes</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Recipes</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 67bac8c..153db7b 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-test</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<name>Curator Testing</name>
<description>Unit testing utilities.</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index fcbbafa..6035681 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery-server</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery Server</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index 1688ae2..b557211 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 749deea..372869d 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>apache-curator</artifactId>
<groupId>org.apache.curator</groupId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>curator-x-rpc</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<name>Curator RPC Proxy</name>
<description>A proxy that bridges non-java environments with the Curator framework and recipes</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/fd5a00c4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4fce651..be3ea33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache Curator</name>
@@ -105,7 +105,7 @@
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git
</developerConnection>
- <tag>apache-curator-2.7.1</tag>
+ <tag>HEAD</tag>
</scm>
<issueManagement>
[29/50] curator git commit: Adding a new constructor to Reaper so
that it can optionally take a fully constructed leader latch that is owned by
another class rather than create its own leader latch
Posted by ca...@apache.org.
Adding a new constructor to Reaper so that it can optionally take a fully constructed leader latch that is owned by another class rather than create its own leader latch
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/520ae54a
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/520ae54a
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/520ae54a
Branch: refs/heads/CURATOR-154
Commit: 520ae54ac4a49292201417fa6b1104cf579704d3
Parents: febfcec
Author: David Kesler <dk...@yodle.com>
Authored: Mon Feb 9 13:19:20 2015 -0500
Committer: David Kesler <dk...@yodle.com>
Committed: Mon Feb 9 13:19:20 2015 -0500
----------------------------------------------------------------------
.../curator/framework/recipes/locks/Reaper.java | 62 +++++++++++---
.../framework/recipes/locks/TestReaper.java | 90 +++++++++++++++++++-
2 files changed, 137 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/520ae54a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
index 8802372..660e3d3 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
@@ -52,6 +52,7 @@ public class Reaper implements Closeable
private final AtomicReference<State> state = new AtomicReference<State>(State.LATENT);
private final LeaderLatch leaderLatch;
private final AtomicBoolean reapingIsActive = new AtomicBoolean(true);
+ private final boolean ownsLeaderLatch;
private enum State
{
@@ -111,7 +112,7 @@ public class Reaper implements Closeable
*/
public Reaper(CuratorFramework client)
{
- this(client, newExecutorService(), DEFAULT_REAPING_THRESHOLD_MS, null);
+ this(client, newExecutorService(), DEFAULT_REAPING_THRESHOLD_MS, (String) null);
}
/**
@@ -122,7 +123,7 @@ public class Reaper implements Closeable
*/
public Reaper(CuratorFramework client, int reapingThresholdMs)
{
- this(client, newExecutorService(), reapingThresholdMs, null);
+ this(client, newExecutorService(), reapingThresholdMs, (String) null);
}
/**
@@ -132,7 +133,7 @@ public class Reaper implements Closeable
*/
public Reaper(CuratorFramework client, ScheduledExecutorService executor, int reapingThresholdMs)
{
- this(client, executor, reapingThresholdMs, null);
+ this(client, executor, reapingThresholdMs, (String) null);
}
/**
@@ -143,18 +144,41 @@ public class Reaper implements Closeable
*/
public Reaper(CuratorFramework client, ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath)
{
+ this(client, executor, reapingThresholdMs, makeLeaderLatchIfPathNotNull(client, leaderPath), true);
+ }
+
+ /**
+ * @param client client
+ * @param executor thread pool
+ * @param reapingThresholdMs threshold in milliseconds that determines that a path can be deleted
+ * @param leaderLatch a pre-created leader latch to ensure only 1 reaper is active in the cluster
+ */
+ public Reaper(CuratorFramework client, ScheduledExecutorService executor, int reapingThresholdMs, LeaderLatch leaderLatch)
+ {
+ this(client, executor, reapingThresholdMs, leaderLatch, false);
+ }
+
+ /**
+ * @param client client
+ * @param executor thread pool
+ * @param reapingThresholdMs threshold in milliseconds that determines that a path can be deleted
+ * @param leaderLatch a pre-created leader latch to ensure only 1 reaper is active in the cluster
+ * @param ownsLeaderLatch indicates whether or not the reaper owns the leader latch (if it exists) and thus should start/stop it
+ * */
+ private Reaper(CuratorFramework client, ScheduledExecutorService executor, int reapingThresholdMs, LeaderLatch leaderLatch, boolean ownsLeaderLatch)
+ {
this.client = client;
this.executor = new CloseableScheduledExecutorService(executor);
this.reapingThresholdMs = reapingThresholdMs / EMPTY_COUNT_THRESHOLD;
-
- LeaderLatch localLeaderLatch = null;
- if ( leaderPath != null )
+ this.leaderLatch = leaderLatch;
+ if (leaderLatch != null)
{
- localLeaderLatch = makeLeaderLatch(client, leaderPath);
+ addListenerToLeaderLatch(leaderLatch);
}
- leaderLatch = localLeaderLatch;
+ this.ownsLeaderLatch = ownsLeaderLatch;
}
+
/**
* Add a path (using Mode.REAP_INDEFINITELY) to be checked by the reaper. The path will be checked periodically
* until the reaper is closed.
@@ -200,7 +224,7 @@ public class Reaper implements Closeable
{
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");
- if ( leaderLatch != null )
+ if ( leaderLatch != null && ownsLeaderLatch)
{
leaderLatch.start();
}
@@ -212,7 +236,7 @@ public class Reaper implements Closeable
if ( state.compareAndSet(State.STARTED, State.CLOSED) )
{
executor.close();
- if ( leaderLatch != null )
+ if ( leaderLatch != null && ownsLeaderLatch )
{
leaderLatch.close();
}
@@ -310,11 +334,10 @@ public class Reaper implements Closeable
return ThreadUtils.newSingleThreadScheduledExecutor("Reaper");
}
- private LeaderLatch makeLeaderLatch(CuratorFramework client, String leaderPath)
+ private void addListenerToLeaderLatch(LeaderLatch leaderLatch)
{
reapingIsActive.set(false);
- LeaderLatch localLeaderLatch = new LeaderLatch(client, leaderPath);
LeaderLatchListener listener = new LeaderLatchListener()
{
@Override
@@ -333,7 +356,18 @@ public class Reaper implements Closeable
reapingIsActive.set(false);
}
};
- localLeaderLatch.addListener(listener);
- return localLeaderLatch;
+ leaderLatch.addListener(listener);
+ }
+
+ private static LeaderLatch makeLeaderLatchIfPathNotNull(CuratorFramework client, String leaderPath)
+ {
+ if (leaderPath == null)
+ {
+ return null;
+ }
+ else
+ {
+ return new LeaderLatch(client, leaderPath);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/curator/blob/520ae54a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
index 83ec960..c47808f 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
@@ -21,6 +21,7 @@ package org.apache.curator.framework.recipes.locks;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.recipes.leader.LeaderLatch;
import org.apache.curator.framework.recipes.leader.LeaderSelector;
import org.apache.curator.framework.recipes.leader.LeaderSelectorListener;
import org.apache.curator.framework.state.ConnectionState;
@@ -48,7 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class TestReaper extends BaseClassForTests
{
@Test
- public void testUsingLeader() throws Exception
+ public void testUsingLeaderPath() throws Exception
{
final Timing timing = new Timing();
CuratorFramework client = makeClient(timing, null);
@@ -118,6 +119,93 @@ public class TestReaper extends BaseClassForTests
}
@Test
+ public void testUsingLeaderLatch() throws Exception
+ {
+ final Timing timing = new Timing();
+ CuratorFramework client = makeClient(timing, null);
+ Reaper reaper1 = null;
+ Reaper reaper2 = null;
+ LeaderLatch leaderLatch1 = null;
+ LeaderLatch leaderLatch2 = null;
+ try
+ {
+ final AtomicInteger reaper1Count = new AtomicInteger();
+ leaderLatch1 = new LeaderLatch(client, "/reaper/leader");
+ reaper1 = new Reaper(client, Reaper.newExecutorService(), 1, leaderLatch1)
+ {
+ @Override
+ protected void reap(PathHolder holder)
+ {
+ reaper1Count.incrementAndGet();
+ super.reap(holder);
+ }
+ };
+
+ final AtomicInteger reaper2Count = new AtomicInteger();
+ leaderLatch2 = new LeaderLatch(client, "/reaper/leader");
+ reaper2 = new Reaper(client, Reaper.newExecutorService(), 1, leaderLatch2)
+ {
+ @Override
+ protected void reap(PathHolder holder)
+ {
+ reaper2Count.incrementAndGet();
+ super.reap(holder);
+ }
+ };
+
+ client.start();
+ client.create().creatingParentsIfNeeded().forPath("/one/two/three");
+
+ leaderLatch1.start();
+ leaderLatch2.start();
+
+ reaper1.start();
+ reaper2.start();
+
+ reaper1.addPath("/one/two/three");
+ reaper2.addPath("/one/two/three");
+
+ timing.sleepABit();
+
+ Assert.assertTrue((reaper1Count.get() == 0) || (reaper2Count.get() == 0));
+ Assert.assertTrue((reaper1Count.get() > 0) || (reaper2Count.get() > 0));
+
+ Reaper activeReaper;
+ LeaderLatch activeLeaderLeatch;
+ AtomicInteger inActiveReaperCount;
+ if ( reaper1Count.get() > 0 )
+ {
+ activeReaper = reaper1;
+ activeLeaderLeatch = leaderLatch1;
+ inActiveReaperCount = reaper2Count;
+ }
+ else
+ {
+ activeReaper = reaper2;
+ activeLeaderLeatch = leaderLatch2;
+ inActiveReaperCount = reaper1Count;
+ }
+ Assert.assertEquals(inActiveReaperCount.get(), 0);
+ activeReaper.close();
+ activeLeaderLeatch.close();
+ timing.sleepABit();
+ Assert.assertTrue(inActiveReaperCount.get() > 0);
+ }
+ finally
+ {
+ CloseableUtils.closeQuietly(reaper1);
+ CloseableUtils.closeQuietly(reaper2);
+ if (leaderLatch1 != null && LeaderLatch.State.STARTED == leaderLatch1.getState()) {
+ CloseableUtils.closeQuietly(leaderLatch1);
+ }
+ if (leaderLatch2 != null && LeaderLatch.State.STARTED == leaderLatch2.getState()) {
+ CloseableUtils.closeQuietly(leaderLatch2);
+ }
+ CloseableUtils.closeQuietly(client);
+ }
+ }
+
+ @Test
public void testUsingManualLeader() throws Exception
{
final Timing timing = new Timing();
[10/50] curator git commit: Merge branch 'CURATOR-179'
Posted by ca...@apache.org.
Merge branch 'CURATOR-179'
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b3fb2cfe
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b3fb2cfe
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b3fb2cfe
Branch: refs/heads/CURATOR-154
Commit: b3fb2cfee9ada524edb6319c327bfcf4fd0c0320
Parents: dad2888 9098606
Author: Cameron McKenzie <ca...@unico.com.au>
Authored: Tue Jan 13 10:04:02 2015 +1100
Committer: Cameron McKenzie <ca...@unico.com.au>
Committed: Tue Jan 13 10:04:02 2015 +1100
----------------------------------------------------------------------
.../java/org/apache/curator/utils/ZKPaths.java | 15 ++++++++++++++-
.../curator/framework/imps/CreateBuilderImpl.java | 2 +-
.../framework/imps/CuratorFrameworkImpl.java | 7 ++++++-
.../curator/framework/imps/NamespaceFacade.java | 8 +++++++-
.../curator/framework/imps/NamespaceImpl.java | 6 +++---
.../curator/framework/imps/TestFramework.java | 18 ++++++++++++++++++
6 files changed, 49 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/b3fb2cfe/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/b3fb2cfe/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/b3fb2cfe/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
[14/50] curator git commit: back to 2.7.1 cause I f'd up the release
Posted by ca...@apache.org.
back to 2.7.1 cause I f'd up the release
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/169b610a
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/169b610a
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/169b610a
Branch: refs/heads/CURATOR-154
Commit: 169b610adcdaff3ac14d58c89ff5dc6c5f5ef108
Parents: 3dc0c0c
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 21:53:42 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 21:53:42 2015 -0500
----------------------------------------------------------------------
curator-client/pom.xml | 4 ++--
curator-examples/pom.xml | 2 +-
curator-framework/pom.xml | 4 ++--
curator-recipes/pom.xml | 4 ++--
curator-test/pom.xml | 4 ++--
curator-x-discovery-server/pom.xml | 4 ++--
curator-x-discovery/pom.xml | 4 ++--
curator-x-rpc/pom.xml | 4 ++--
pom.xml | 2 +-
9 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index 251d2b0..cd0af80 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-client</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Client</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index 96ea4b1..1728ec9 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-examples</artifactId>
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index 67f514f..446c2fd 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-framework</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Framework</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 3ce7d63..4955dde 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-recipes</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Recipes</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 153db7b..5b6352a 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-test</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<name>Curator Testing</name>
<description>Unit testing utilities.</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index 6035681..f6851be 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery-server</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery Server</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index b557211..69d8410 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 372869d..0e0b528 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>apache-curator</artifactId>
<groupId>org.apache.curator</groupId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>curator-x-rpc</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<name>Curator RPC Proxy</name>
<description>A proxy that bridges non-java environments with the Curator framework and recipes</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/169b610a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index be3ea33..3f2d4f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.2-SNAPSHOT</version>
+ <version>2.7.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache Curator</name>
[03/50] curator git commit: Merge branch 'CURATOR-175.2' into
CURATOR-175
Posted by ca...@apache.org.
Merge branch 'CURATOR-175.2' into CURATOR-175
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f2f03ce8
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f2f03ce8
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f2f03ce8
Branch: refs/heads/CURATOR-154
Commit: f2f03ce82179d74177f2595e0221ee4cbbcd86fa
Parents: ab6ad24 94fce2c
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 15:30:07 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 15:30:07 2015 -0500
----------------------------------------------------------------------
.../org/apache/curator/utils/ThreadUtils.java | 5 +
.../framework/imps/CuratorFrameworkImpl.java | 2 +-
.../imps/CuratorTempFrameworkImpl.java | 10 +-
.../framework/recipes/cache/TestTreeCache.java | 14 +++
.../x/discovery/ServiceDiscoveryBuilder.java | 45 +++++---
.../discovery/details/ServiceDiscoveryImpl.java | 82 ++++++++++++---
.../x/discovery/TestServiceDiscovery.java | 102 ++++++++++++-------
.../discovery/details/TestWatchedInstances.java | 94 +++++++++++++++++
8 files changed, 289 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/f2f03ce8/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
----------------------------------------------------------------------
[05/50] curator git commit: Merge branch 'CURATOR-166' of
https://github.com/rfer/curator into CURATOR-166
Posted by ca...@apache.org.
Merge branch 'CURATOR-166' of https://github.com/rfer/curator into CURATOR-166
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/687672a3
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/687672a3
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/687672a3
Branch: refs/heads/CURATOR-154
Commit: 687672a390033203661aa368fa32a4d1673761e8
Parents: 7a97315 b387cf0
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 15:41:13 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 15:41:13 2015 -0500
----------------------------------------------------------------------
.../java/org/apache/curator/utils/ZKPaths.java | 88 +++++++++++++++-----
.../org/apache/curator/utils/TestZKPaths.java | 10 +++
2 files changed, 79 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
[19/50] curator git commit: minor formatting
Posted by ca...@apache.org.
minor formatting
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9d61c122
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9d61c122
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9d61c122
Branch: refs/heads/CURATOR-154
Commit: 9d61c122890a6a147a9a63ec7b503a14b1e61b90
Parents: 9ccf2a3
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 13 07:47:07 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jan 13 07:47:07 2015 -0500
----------------------------------------------------------------------
.../framework/CuratorFrameworkFactory.java | 24 ++++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/9d61c122/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 317426d..fdcae48 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
@@ -406,20 +406,20 @@ public class CuratorFrameworkFactory
{
switch ( authInfos.size() )
{
- case 0:
- {
- return null;
- }
+ case 0:
+ {
+ return null;
+ }
- case 1:
- {
- return authInfos.get(0).getAuth();
- }
+ case 1:
+ {
+ return authInfos.get(0).getAuth();
+ }
- default:
- {
- throw new IllegalStateException("More than 1 auth has been added");
- }
+ default:
+ {
+ throw new IllegalStateException("More than 1 auth has been added");
+ }
}
}
[25/50] curator git commit: Added license header
Posted by ca...@apache.org.
Added license header
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/383c9ae6
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/383c9ae6
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/383c9ae6
Branch: refs/heads/CURATOR-154
Commit: 383c9ae683621886023b9a951baadac36bdae15b
Parents: fd5a00c
Author: randgalt <ra...@apache.org>
Authored: Thu Jan 15 13:21:05 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu Jan 15 13:21:05 2015 -0500
----------------------------------------------------------------------
curator-x-rpc/pom.xml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/383c9ae6/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 372869d..7dfcc85 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -1,4 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apache-curator</artifactId>
[50/50] curator git commit: Merge branch 'master' into CURATOR-154
Posted by ca...@apache.org.
Merge branch 'master' into CURATOR-154
Conflicts:
curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6e16d0d5
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6e16d0d5
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6e16d0d5
Branch: refs/heads/CURATOR-154
Commit: 6e16d0d5c35fa02b6976037d230a0e25e25d7572
Parents: 64973b0 c65e091
Author: Cameron McKenzie <ca...@unico.com.au>
Authored: Wed Apr 22 09:06:29 2015 +1000
Committer: Cameron McKenzie <ca...@unico.com.au>
Committed: Wed Apr 22 09:06:29 2015 +1000
----------------------------------------------------------------------
curator-client/pom.xml | 4 +-
.../org/apache/curator/utils/ThreadUtils.java | 5 +
.../java/org/apache/curator/utils/ZKPaths.java | 103 ++++--
.../org/apache/curator/utils/TestZKPaths.java | 11 +
curator-examples/pom.xml | 2 +-
.../main/java/discovery/InstanceDetails.java | 2 +-
curator-framework/pom.xml | 4 +-
.../org/apache/curator/framework/AuthInfo.java | 51 +++
.../framework/CuratorFrameworkFactory.java | 127 +++++--
.../framework/imps/CreateBuilderImpl.java | 16 +-
.../framework/imps/CuratorFrameworkImpl.java | 116 +++---
.../imps/CuratorTempFrameworkImpl.java | 10 +-
.../framework/imps/DeleteBuilderImpl.java | 103 +++---
.../curator/framework/imps/NamespaceFacade.java | 8 +-
.../curator/framework/imps/NamespaceImpl.java | 6 +-
.../curator/framework/imps/TestFramework.java | 349 ++++++++++++-------
.../framework/imps/TestFrameworkEdges.java | 81 ++++-
curator-recipes/pom.xml | 4 +-
.../recipes/cache/PathChildrenCache.java | 16 +-
.../framework/recipes/cache/TreeCache.java | 2 +-
.../framework/recipes/locks/ChildReaper.java | 157 ++++++++-
.../locks/InterProcessReadWriteLock.java | 34 +-
.../recipes/locks/InterProcessSemaphoreV2.java | 7 +
.../curator/framework/recipes/locks/Reaper.java | 65 +++-
.../recipes/nodes/PersistentEphemeralNode.java | 2 +-
.../src/site/confluence/Tree-cache.confluence | 39 ---
.../src/site/confluence/tree-cache.confluence | 39 +++
.../framework/recipes/cache/TestTreeCache.java | 43 +++
.../recipes/leader/TestLeaderSelector.java | 67 ++++
.../recipes/locks/TestChildReaper.java | 248 ++++++++++++-
.../locks/TestInterProcessReadWriteLock.java | 33 ++
.../locks/TestInterProcessSemaphore.java | 40 +++
.../framework/recipes/locks/TestReaper.java | 90 ++++-
.../nodes/TestPersistentEphemeralNode.java | 37 ++
curator-test/pom.xml | 4 +-
curator-x-discovery-server/pom.xml | 4 +-
.../contexts/GenericDiscoveryContext.java | 8 +-
.../contexts/IntegerDiscoveryContext.java | 4 +-
.../server/contexts/StringDiscoveryContext.java | 4 +-
.../entity/JsonServiceInstanceMarshaller.java | 6 +-
.../entity/JsonServiceInstancesMarshaller.java | 8 +-
.../entity/JsonServiceNamesMarshaller.java | 8 +-
.../discovery/server/rest/DiscoveryContext.java | 4 +-
.../server/jetty_jersey/ServiceDetails.java | 4 +-
curator-x-discovery/pom.xml | 18 +-
.../x/discovery/ServiceDiscoveryBuilder.java | 45 ++-
.../curator/x/discovery/ServiceInstance.java | 6 +-
.../details/JsonInstanceSerializer.java | 4 +-
.../discovery/details/ServiceDiscoveryImpl.java | 81 ++++-
.../x/discovery/TestServiceDiscovery.java | 106 ++++--
.../discovery/details/TestWatchedInstances.java | 94 +++++
curator-x-rpc/pom.xml | 23 +-
.../java/org/apache/curator/x/rpc/RpcTests.java | 6 +-
pom.xml | 84 +----
54 files changed, 1854 insertions(+), 588 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/6e16d0d5/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/6e16d0d5/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
----------------------------------------------------------------------
diff --cc curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
index 31e7ef2,8bc8d3d..1c66271
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
@@@ -465,76 -464,40 +466,112 @@@ public class TestPersistentEphemeralNod
}
/**
+ * Test that if a persistent ephemeral node is created and the node already exists
+ * that if data is present in the PersistentEphermalNode that it is still set.
+ * @throws Exception
+ */
+ @Test
+ public void testSetDataWhenNodeExists() throws Exception
+ {
+ CuratorFramework curator = newCurator();
+ curator.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(PATH, "InitialData".getBytes());
+
+ byte[] data = "Hello World".getBytes();
+
+ PersistentEphemeralNode node = new PersistentEphemeralNode(curator, PersistentEphemeralNode.Mode.EPHEMERAL, PATH, data);
+ node.start();
+ try
+ {
+ node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
+ assertTrue(Arrays.equals(curator.getData().forPath(node.getActualPath()), data));
+ }
+ finally
+ {
+ node.close();
+ }
+ }
+
+ @Test
+ public void testSetDataWhenDisconnected() throws Exception
+ {
+ CuratorFramework curator = newCurator();
+
+ byte[] initialData = "Hello World".getBytes();
+ byte[] updatedData = "Updated".getBytes();
+
+ PersistentEphemeralNode node = new PersistentEphemeralNode(curator, PersistentEphemeralNode.Mode.EPHEMERAL, PATH, initialData);
+ node.start();
+ try
+ {
+ node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
+ assertTrue(Arrays.equals(curator.getData().forPath(node.getActualPath()), initialData));
+
+ server.stop();
+
+ final CountDownLatch dataUpdateLatch = new CountDownLatch(1);
+
+ Watcher watcher = new Watcher()
+ {
+ @Override
+ public void process(WatchedEvent event)
+ {
+ if ( event.getType() == EventType.NodeDataChanged )
+ {
+ dataUpdateLatch.countDown();
+ }
+ }
+ };
+
+ curator.getData().usingWatcher(watcher).inBackground().forPath(node.getActualPath());
+
+ node.setData(updatedData);
+ server.restart();
+
+ assertTrue(timing.awaitLatch(dataUpdateLatch));
+
+ assertTrue(Arrays.equals(curator.getData().forPath(node.getActualPath()), updatedData));
+ }
+ finally
+ {
+ node.close();
+ }
+ }
++
++ /**
+ * See CURATOR-190
+ * For protected nodes on reconnect the current protected name was passed to the create builder meaning that it got
+ * appended to the new protected node name. This meant that a new node got created on each reconnect.
+ * @throws Exception
+ */
+ @Test
+ public void testProtected() throws Exception
+ {
+ CuratorFramework curator = newCurator();
+
+ PersistentEphemeralNode node = new PersistentEphemeralNode(curator, PersistentEphemeralNode.Mode.PROTECTED_EPHEMERAL, PATH,
+ new byte[0]);
+ node.start();
+ try
+ {
+ node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
+ assertNodeExists(curator, node.getActualPath());
+
+ server.restart();
+
+ curator.blockUntilConnected(5, TimeUnit.SECONDS);
+
+ assertNodeExists(curator, node.getActualPath());
+
+ //There should only be a single child, the persisted ephemeral node
+ List<String> children = curator.getChildren().forPath(DIR);
+ assertFalse(children == null);
+ assertEquals(children.size(), 1);
+ }
+ finally
+ {
+ node.close();
+ }
+ }
private void assertNodeExists(CuratorFramework curator, String path) throws Exception
{
[46/50] curator git commit: Merge branch 'CURATOR-203'
Posted by ca...@apache.org.
Merge branch 'CURATOR-203'
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/5f291bbc
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/5f291bbc
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/5f291bbc
Branch: refs/heads/CURATOR-154
Commit: 5f291bbcb3cc219575e906dde0a0c112b5bfa7d7
Parents: 2db9a6d 9ab4668
Author: randgalt <ra...@apache.org>
Authored: Tue Apr 21 10:31:04 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Apr 21 10:31:04 2015 -0500
----------------------------------------------------------------------
.../framework/recipes/locks/ChildReaper.java | 54 ++++-
.../recipes/locks/TestChildReaper.java | 195 +++++++++++++++----
2 files changed, 209 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
[38/50] curator git commit: make sure ChildReaper always moves
through all registered nodes. Also,
add an optionl check so that large nodes are never queried
Posted by ca...@apache.org.
make sure ChildReaper always moves through all registered nodes. Also, add an optionl check so that large nodes are never queried
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/7fe94bb1
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/7fe94bb1
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/7fe94bb1
Branch: refs/heads/CURATOR-154
Commit: 7fe94bb1517fa32dcb2e1972ada9b7b493c1108b
Parents: 6a56c51
Author: randgalt <ra...@apache.org>
Authored: Mon Apr 6 16:41:24 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Apr 6 16:41:24 2015 -0500
----------------------------------------------------------------------
.../framework/recipes/locks/ChildReaper.java | 52 ++++-
.../recipes/locks/TestChildReaper.java | 195 +++++++++++++++----
2 files changed, 207 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/7fe94bb1/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
index 6a2c05a..ee5c414 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
@@ -1,3 +1,4 @@
+
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,13 +19,14 @@
*/
package org.apache.curator.framework.recipes.locks;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-
-import org.apache.curator.framework.recipes.leader.LeaderLatch;
-import org.apache.curator.utils.CloseableUtils;
import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.recipes.leader.LeaderLatch;
import org.apache.curator.utils.CloseableScheduledExecutorService;
+import org.apache.curator.utils.CloseableUtils;
+import org.apache.curator.utils.PathUtils;
import org.apache.curator.utils.ThreadUtils;
import org.apache.curator.utils.ZKPaths;
import org.apache.zookeeper.data.Stat;
@@ -34,13 +36,14 @@ import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.curator.utils.PathUtils;
/**
* Utility to reap empty child nodes of a parent node. Periodically calls getChildren on
@@ -53,11 +56,13 @@ public class ChildReaper implements Closeable
private final AtomicReference<State> state = new AtomicReference<State>(State.LATENT);
private final CuratorFramework client;
private final Collection<String> paths = Sets.newConcurrentHashSet();
+ private volatile Iterator<String> pathIterator = null;
private final Reaper.Mode mode;
private final CloseableScheduledExecutorService executor;
private final int reapingThresholdMs;
private final LeaderLatch leaderLatch;
private final Set<String> lockSchema;
+ private final AtomicInteger maxChildren = new AtomicInteger(-1);
private volatile Future<?> task;
@@ -210,19 +215,54 @@ public class ChildReaper implements Closeable
return paths.remove(PathUtils.validatePath(path));
}
+ /**
+ * If a node has so many children that {@link CuratorFramework#getChildren()} will fail
+ * (due to jute.maxbuffer) it can cause connection instability. Set the max number of
+ * children here to prevent the path from being queried in these cases. The number should usually
+ * be: avergage-node-name/1000000
+ *
+ * @param maxChildren max children
+ */
+ public void setMaxChildren(int maxChildren)
+ {
+ this.maxChildren.set(maxChildren);
+ }
+
public static ScheduledExecutorService newExecutorService()
{
return ThreadUtils.newFixedThreadScheduledPool(2, "ChildReaper");
}
+ @VisibleForTesting
+ protected void warnMaxChildren(String path, Stat stat)
+ {
+ log.warn(String.format("Skipping %s as it has too many children: %d", path, stat.getNumChildren()));
+ }
+
private void doWork()
{
- if (shouldDoWork())
+ if ( shouldDoWork() )
{
- for ( String path : paths )
+ if ( (pathIterator == null) || !pathIterator.hasNext() )
+ {
+ pathIterator = paths.iterator();
+ }
+ while ( pathIterator.hasNext() )
{
+ String path = pathIterator.next();
try
{
+ int maxChildren = this.maxChildren.get();
+ if ( maxChildren > 0 )
+ {
+ Stat stat = client.checkExists().forPath(path);
+ if ( (stat != null) && (stat.getNumChildren() > maxChildren) )
+ {
+ warnMaxChildren(path, stat);
+ continue;
+ }
+ }
+
List<String> children = client.getChildren().forPath(path);
for ( String name : children )
{
http://git-wip-us.apache.org/repos/asf/curator/blob/7fe94bb1/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
index d81bb3a..906d9d4 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
@@ -6,9 +6,9 @@
* 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* 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
@@ -16,35 +16,161 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.curator.framework.recipes.locks;
-import org.apache.curator.framework.recipes.leader.LeaderLatch;
-import org.apache.curator.test.BaseClassForTests;
-import org.apache.curator.utils.CloseableUtils;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.recipes.leader.LeaderLatch;
+import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
+import org.apache.curator.test.TestingServer;
import org.apache.curator.test.Timing;
+import org.apache.curator.utils.CloseableUtils;
+import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.Random;
+import java.util.concurrent.CountDownLatch;
public class TestChildReaper extends BaseClassForTests
{
@Test
- public void testSomeNodes() throws Exception
+ public void testMaxChildren() throws Exception
+ {
+ server.close();
+
+ final int LARGE_QTY = 10000;
+
+ System.setProperty("jute.maxbuffer", "" + LARGE_QTY);
+ server = new TestingServer();
+ try
+ {
+ Timing timing = new Timing();
+ ChildReaper reaper = null;
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new ExponentialBackoffRetry(100, 3));
+ try
+ {
+ client.start();
+
+ for ( int i = 0; i < LARGE_QTY; ++i )
+ {
+ if ( (i % 1000) == 0 )
+ {
+ System.out.println(i);
+ }
+ client.create().creatingParentsIfNeeded().forPath("/big/node-" + i);
+ }
+
+ try
+ {
+ client.getChildren().forPath("/big");
+ Assert.fail("Should have been a connection loss");
+ }
+ catch ( KeeperException.ConnectionLossException e )
+ {
+ // expected
+ }
+
+ final CountDownLatch latch = new CountDownLatch(1);
+ reaper = new ChildReaper(client, "/big", Reaper.Mode.REAP_UNTIL_DELETE, 1)
+ {
+ @Override
+ protected void warnMaxChildren(String path, Stat stat)
+ {
+ latch.countDown();
+ super.warnMaxChildren(path, stat);
+ }
+ };
+ reaper.setMaxChildren(100);
+ reaper.start();
+ Assert.assertTrue(timing.awaitLatch(latch));
+ }
+ finally
+ {
+ CloseableUtils.closeQuietly(reaper);
+ CloseableUtils.closeQuietly(client);
+ }
+ }
+ finally
+ {
+ System.clearProperty("jute.maxbuffer");
+ }
+ }
+
+ @Test
+ public void testLargeNodes() throws Exception
{
+ server.close();
+
+ final int LARGE_QTY = 10000;
+ final int SMALL_QTY = 100;
+
+ System.setProperty("jute.maxbuffer", "" + LARGE_QTY);
+ server = new TestingServer();
+ try
+ {
+ Timing timing = new Timing();
+ ChildReaper reaper = null;
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new ExponentialBackoffRetry(100, 3));
+ try
+ {
+ client.start();
+
+ for ( int i = 0; i < LARGE_QTY; ++i )
+ {
+ if ( (i % 1000) == 0 )
+ {
+ System.out.println(i);
+ }
+ client.create().creatingParentsIfNeeded().forPath("/big/node-" + i);
+
+ if ( i < SMALL_QTY )
+ {
+ client.create().creatingParentsIfNeeded().forPath("/small/node-" + i);
+ }
+ }
+
+ reaper = new ChildReaper(client, "/foo", Reaper.Mode.REAP_UNTIL_DELETE, 1);
+ reaper.start();
- Timing timing = new Timing();
- ChildReaper reaper = null;
- CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+ reaper.addPath("/big");
+ reaper.addPath("/small");
+
+ int count = -1;
+ for ( int i = 0; (i < 10) && (count != 0); ++i )
+ {
+ timing.sleepABit();
+ count = client.checkExists().forPath("/small").getNumChildren();
+ }
+ Assert.assertEquals(count, 0);
+ }
+ finally
+ {
+ CloseableUtils.closeQuietly(reaper);
+ CloseableUtils.closeQuietly(client);
+ }
+ }
+ finally
+ {
+ System.clearProperty("jute.maxbuffer");
+ }
+ }
+
+ @Test
+ public void testSomeNodes() throws Exception
+ {
+ Timing timing = new Timing();
+ ChildReaper reaper = null;
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
try
{
client.start();
- Random r = new Random();
- int nonEmptyNodes = 0;
+ Random r = new Random();
+ int nonEmptyNodes = 0;
for ( int i = 0; i < 10; ++i )
{
client.create().creatingParentsIfNeeded().forPath("/test/" + Integer.toString(i));
@@ -60,7 +186,7 @@ public class TestChildReaper extends BaseClassForTests
timing.forWaiting().sleepABit();
- Stat stat = client.checkExists().forPath("/test");
+ Stat stat = client.checkExists().forPath("/test");
Assert.assertEquals(stat.getNumChildren(), nonEmptyNodes);
}
finally
@@ -71,11 +197,11 @@ public class TestChildReaper extends BaseClassForTests
}
@Test
- public void testSimple() throws Exception
+ public void testSimple() throws Exception
{
- Timing timing = new Timing();
- ChildReaper reaper = null;
- CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+ Timing timing = new Timing();
+ ChildReaper reaper = null;
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
try
{
client.start();
@@ -90,7 +216,7 @@ public class TestChildReaper extends BaseClassForTests
timing.forWaiting().sleepABit();
- Stat stat = client.checkExists().forPath("/test");
+ Stat stat = client.checkExists().forPath("/test");
Assert.assertEquals(stat.getNumChildren(), 0);
}
finally
@@ -101,11 +227,11 @@ public class TestChildReaper extends BaseClassForTests
}
@Test
- public void testLeaderElection() throws Exception
+ public void testLeaderElection() throws Exception
{
- Timing timing = new Timing();
- ChildReaper reaper = null;
- CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+ Timing timing = new Timing();
+ ChildReaper reaper = null;
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
LeaderLatch otherLeader = null;
try
{
@@ -118,6 +244,7 @@ public class TestChildReaper extends BaseClassForTests
otherLeader = new LeaderLatch(client, "/test-leader");
otherLeader.start();
+ otherLeader.await();
reaper = new ChildReaper(client, "/test", Reaper.Mode.REAP_UNTIL_DELETE, ChildReaper.newExecutorService(), 1, "/test-leader");
reaper.start();
@@ -125,7 +252,7 @@ public class TestChildReaper extends BaseClassForTests
timing.forWaiting().sleepABit();
//Should not have reaped anything at this point since otherLeader is still leader
- Stat stat = client.checkExists().forPath("/test");
+ Stat stat = client.checkExists().forPath("/test");
Assert.assertEquals(stat.getNumChildren(), 10);
CloseableUtils.closeQuietly(otherLeader);
@@ -138,7 +265,7 @@ public class TestChildReaper extends BaseClassForTests
finally
{
CloseableUtils.closeQuietly(reaper);
- if (otherLeader != null && otherLeader.getState() == LeaderLatch.State.STARTED)
+ if ( otherLeader != null && otherLeader.getState() == LeaderLatch.State.STARTED )
{
CloseableUtils.closeQuietly(otherLeader);
}
@@ -147,11 +274,11 @@ public class TestChildReaper extends BaseClassForTests
}
@Test
- public void testMultiPath() throws Exception
+ public void testMultiPath() throws Exception
{
- Timing timing = new Timing();
- ChildReaper reaper = null;
- CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+ Timing timing = new Timing();
+ ChildReaper reaper = null;
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
try
{
client.start();
@@ -169,7 +296,7 @@ public class TestChildReaper extends BaseClassForTests
timing.forWaiting().sleepABit();
- Stat stat = client.checkExists().forPath("/test1");
+ Stat stat = client.checkExists().forPath("/test1");
Assert.assertEquals(stat.getNumChildren(), 0);
stat = client.checkExists().forPath("/test2");
Assert.assertEquals(stat.getNumChildren(), 0);
@@ -184,11 +311,11 @@ public class TestChildReaper extends BaseClassForTests
}
@Test
- public void testNamespace() throws Exception
+ public void testNamespace() throws Exception
{
- Timing timing = new Timing();
- ChildReaper reaper = null;
- CuratorFramework client = CuratorFrameworkFactory.builder()
+ Timing timing = new Timing();
+ ChildReaper reaper = null;
+ CuratorFramework client = CuratorFrameworkFactory.builder()
.connectString(server.getConnectString())
.sessionTimeoutMs(timing.session())
.connectionTimeoutMs(timing.connection())
@@ -209,7 +336,7 @@ public class TestChildReaper extends BaseClassForTests
timing.forWaiting().sleepABit();
- Stat stat = client.checkExists().forPath("/test");
+ Stat stat = client.checkExists().forPath("/test");
Assert.assertEquals(stat.getNumChildren(), 0);
stat = client.usingNamespace(null).checkExists().forPath("/foo/test");
[41/50] curator git commit: some logging
Posted by ca...@apache.org.
some logging
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9ab4668e
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9ab4668e
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9ab4668e
Branch: refs/heads/CURATOR-154
Commit: 9ab4668e717ad8268b33ce55807f4c26b1ad1077
Parents: dd03a63
Author: randgalt <ra...@apache.org>
Authored: Tue Apr 7 18:56:41 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Apr 7 18:56:41 2015 -0500
----------------------------------------------------------------------
.../org/apache/curator/framework/recipes/locks/ChildReaper.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/9ab4668e/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
index a0a3fd0..2a1d73e 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
@@ -264,6 +264,7 @@ public class ChildReaper implements Closeable
}
List<String> children = client.getChildren().forPath(path);
+ log.info(String.format("Found %d children for %s", children.size(), path));
for ( String name : children )
{
String childPath = ZKPaths.makePath(path, name);
@@ -288,6 +289,7 @@ public class ChildReaper implements Closeable
Stat stat = client.checkExists().forPath(path);
if ( (stat != null) && (stat.getNumChildren() == 0) )
{
+ log.info("Adding " + path);
reaper.addPath(path, mode);
}
}
[28/50] curator git commit: Port Codehaus Jackson to fasterxml
Jackson.
Posted by ca...@apache.org.
Port Codehaus Jackson to fasterxml Jackson.
One line of executable code changed, here, in
org.apache.curator.x.discovery.server.contexts.GenericDiscoveryContext#unMarshallJson
@Override
public T unMarshallJson(JsonNode node) throws Exception
{
T payload;
ObjectMapper mapper = new ObjectMapper();
//noinspection unchecked
payload = (T)mapper.readValue(mapper.treeAsTokens(node), // <<<<<<<<<<<<<<<<
payloadType.getRawType());
return payload;
}
Jackson v2 has no method on ObjectMapper supporting readValue(JsonNode, Class). However, Jackson v1 states the form I used
is a shortcut for that legacy method.
All other changes to the code and poms were simply replacing imports
and maven dependencies.
Jackson 2.3.2 was chosen to be compatible with the version already
being transitively provided through the dependency
io.dropwizard:dropwizard-configuration:jar:0.7.0:compile
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4bd2c0bf
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4bd2c0bf
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4bd2c0bf
Branch: refs/heads/CURATOR-154
Commit: 4bd2c0bfb516f23c8ca168642cf43f6a1822fbd9
Parents: febfcec
Author: Mark Petrovic <ma...@xoom.com>
Authored: Wed Jan 21 16:28:00 2015 -0800
Committer: Mark Petrovic <ma...@xoom.com>
Committed: Fri Jan 23 09:00:04 2015 -0800
----------------------------------------------------------------------
.../main/java/discovery/InstanceDetails.java | 2 +-
.../contexts/GenericDiscoveryContext.java | 8 ++++----
.../contexts/IntegerDiscoveryContext.java | 4 ++--
.../server/contexts/StringDiscoveryContext.java | 4 ++--
.../entity/JsonServiceInstanceMarshaller.java | 6 +++---
.../entity/JsonServiceInstancesMarshaller.java | 8 ++++----
.../entity/JsonServiceNamesMarshaller.java | 8 ++++----
.../discovery/server/rest/DiscoveryContext.java | 4 ++--
.../server/jetty_jersey/ServiceDetails.java | 4 ++--
curator-x-discovery/pom.xml | 14 ++++++++++++--
.../curator/x/discovery/ServiceInstance.java | 6 ++----
.../details/JsonInstanceSerializer.java | 4 ++--
.../java/org/apache/curator/x/rpc/RpcTests.java | 6 +++---
pom.xml | 20 ++++++++++++++++----
14 files changed, 59 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-examples/src/main/java/discovery/InstanceDetails.java
----------------------------------------------------------------------
diff --git a/curator-examples/src/main/java/discovery/InstanceDetails.java b/curator-examples/src/main/java/discovery/InstanceDetails.java
index 0a4152e..91e465a 100644
--- a/curator-examples/src/main/java/discovery/InstanceDetails.java
+++ b/curator-examples/src/main/java/discovery/InstanceDetails.java
@@ -18,7 +18,7 @@
*/
package discovery;
-import org.codehaus.jackson.map.annotate.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonRootName;
/**
* In a real application, the Service payload will most likely
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java
index 4929ccc..ae870a5 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java
@@ -18,13 +18,13 @@
*/
package org.apache.curator.x.discovery.server.contexts;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.reflect.TypeToken;
import org.apache.curator.x.discovery.ProviderStrategy;
import org.apache.curator.x.discovery.ServiceDiscovery;
import org.apache.curator.x.discovery.server.rest.DiscoveryContext;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.node.ObjectNode;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
@@ -88,7 +88,7 @@ public class GenericDiscoveryContext<T> implements DiscoveryContext<T>, ContextR
T payload;
ObjectMapper mapper = new ObjectMapper();
//noinspection unchecked
- payload = (T)mapper.readValue(node, payloadType.getRawType());
+ payload = (T)mapper.readValue(mapper.treeAsTokens(node), payloadType.getRawType());
return payload;
}
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/IntegerDiscoveryContext.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/IntegerDiscoveryContext.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/IntegerDiscoveryContext.java
index 7f640d1..27ee618 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/IntegerDiscoveryContext.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/IntegerDiscoveryContext.java
@@ -18,11 +18,11 @@
*/
package org.apache.curator.x.discovery.server.contexts;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.curator.x.discovery.ProviderStrategy;
import org.apache.curator.x.discovery.ServiceDiscovery;
import org.apache.curator.x.discovery.server.rest.DiscoveryContext;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.node.ObjectNode;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/StringDiscoveryContext.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/StringDiscoveryContext.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/StringDiscoveryContext.java
index a16e6f3..d1d6cf2 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/StringDiscoveryContext.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/StringDiscoveryContext.java
@@ -18,11 +18,11 @@
*/
package org.apache.curator.x.discovery.server.contexts;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.curator.x.discovery.ProviderStrategy;
import org.apache.curator.x.discovery.ServiceDiscovery;
import org.apache.curator.x.discovery.server.rest.DiscoveryContext;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.node.ObjectNode;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstanceMarshaller.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstanceMarshaller.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstanceMarshaller.java
index f461d04..f7007c2 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstanceMarshaller.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstanceMarshaller.java
@@ -18,13 +18,13 @@
*/
package org.apache.curator.x.discovery.server.entity;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.curator.x.discovery.ServiceInstance;
import org.apache.curator.x.discovery.ServiceInstanceBuilder;
import org.apache.curator.x.discovery.ServiceType;
import org.apache.curator.x.discovery.server.rest.DiscoveryContext;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.node.ObjectNode;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstancesMarshaller.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstancesMarshaller.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstancesMarshaller.java
index 168e508..4ba61bd 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstancesMarshaller.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceInstancesMarshaller.java
@@ -18,13 +18,13 @@
*/
package org.apache.curator.x.discovery.server.entity;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Lists;
import org.apache.curator.x.discovery.ServiceInstance;
import org.apache.curator.x.discovery.server.rest.DiscoveryContext;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.node.ArrayNode;
-import org.codehaus.jackson.node.ObjectNode;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceNamesMarshaller.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceNamesMarshaller.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceNamesMarshaller.java
index 428277e..61accf4 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceNamesMarshaller.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/entity/JsonServiceNamesMarshaller.java
@@ -18,11 +18,11 @@
*/
package org.apache.curator.x.discovery.server.entity;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Lists;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.node.ArrayNode;
-import org.codehaus.jackson.node.ObjectNode;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/rest/DiscoveryContext.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/rest/DiscoveryContext.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/rest/DiscoveryContext.java
index 30ea77a..099048a 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/rest/DiscoveryContext.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/rest/DiscoveryContext.java
@@ -18,10 +18,10 @@
*/
package org.apache.curator.x.discovery.server.rest;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.curator.x.discovery.ProviderStrategy;
import org.apache.curator.x.discovery.ServiceDiscovery;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.node.ObjectNode;
/**
* Bridge between the specifics of your needs and the generic implementation
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/ServiceDetails.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/ServiceDetails.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/ServiceDetails.java
index eefcdad..2db5c88 100644
--- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/ServiceDetails.java
+++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/ServiceDetails.java
@@ -18,11 +18,11 @@
*/
package org.apache.curator.x.discovery.server.jetty_jersey;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
import java.util.HashMap;
import java.util.Map;
-import org.codehaus.jackson.map.annotate.JsonRootName;
-
/**
* Service payload describing details of a service.
*/
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index b557211..51cad07 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -51,8 +51,18 @@
</dependency>
<dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
index 939e708..f4f3b7d 100644
--- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
+++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstance.java
@@ -18,6 +18,7 @@
*/
package org.apache.curator.x.discovery;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import java.net.InetAddress;
@@ -25,9 +26,6 @@ import java.util.Collection;
import java.util.Map;
import java.util.UUID;
-import org.codehaus.jackson.annotate.JsonTypeInfo;
-import org.codehaus.jackson.annotate.JsonTypeInfo.Id;
-
/**
* POJO that represents a service instance
*/
@@ -124,7 +122,7 @@ public class ServiceInstance<T>
return sslPort;
}
- @JsonTypeInfo(use=Id.CLASS, defaultImpl=Object.class)
+ @JsonTypeInfo(use= JsonTypeInfo.Id.CLASS, defaultImpl=Object.class)
public T getPayload()
{
return payload;
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/JsonInstanceSerializer.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/JsonInstanceSerializer.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/JsonInstanceSerializer.java
index b7ddbc2..164bdb0 100644
--- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/JsonInstanceSerializer.java
+++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/JsonInstanceSerializer.java
@@ -18,9 +18,9 @@
*/
package org.apache.curator.x.discovery.details;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.curator.x.discovery.ServiceInstance;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.JavaType;
import java.io.ByteArrayOutputStream;
/**
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java
----------------------------------------------------------------------
diff --git a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java
index a0e0a42..87a5bb8 100644
--- a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java
+++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java
@@ -18,6 +18,9 @@
*/
package org.apache.curator.x.rpc;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.generated.*;
@@ -32,9 +35,6 @@ import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.node.ArrayNode;
-import org.codehaus.jackson.node.ObjectNode;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
http://git-wip-us.apache.org/repos/asf/curator/blob/4bd2c0bf/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index be3ea33..01592c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@
<apache-rat-plugin-version>0.10</apache-rat-plugin-version>
<javassist-version>3.18.1-GA</javassist-version>
<commons-math-version>2.2</commons-math-version>
- <jackson-mapper-asl-version>1.9.13</jackson-mapper-asl-version>
+ <jackson-version>2.3.2</jackson-version>
<jersey-version>1.18.1</jersey-version>
<jsr311-api-version>1.1.1</jsr311-api-version>
<jetty-version>6.1.26</jetty-version>
@@ -354,9 +354,21 @@
</dependency>
<dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <version>${jackson-mapper-asl-version}</version>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson-version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson-version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson-version}</version>
</dependency>
<dependency>
[15/50] curator git commit: [maven-release-plugin] prepare for next
development iteration
Posted by ca...@apache.org.
[maven-release-plugin] prepare for next development iteration
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/674f3943
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/674f3943
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/674f3943
Branch: refs/heads/CURATOR-154
Commit: 674f394360f0d27b5db4f1358112cd1676ba233f
Parents: f68a0d6
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 21:56:00 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 21:56:00 2015 -0500
----------------------------------------------------------------------
curator-client/pom.xml | 4 ++--
curator-examples/pom.xml | 2 +-
curator-framework/pom.xml | 4 ++--
curator-recipes/pom.xml | 4 ++--
curator-test/pom.xml | 4 ++--
curator-x-discovery-server/pom.xml | 4 ++--
curator-x-discovery/pom.xml | 4 ++--
curator-x-rpc/pom.xml | 4 ++--
pom.xml | 4 ++--
9 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index b21ab7e..251d2b0 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-client</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Client</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index 8a55dc0..96ea4b1 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-examples</artifactId>
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index f5b309d..67f514f 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-framework</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Framework</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 348cc48..3ce7d63 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-recipes</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Recipes</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 67bac8c..153db7b 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-test</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<name>Curator Testing</name>
<description>Unit testing utilities.</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index fcbbafa..6035681 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery-server</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery Server</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index 1688ae2..b557211 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 749deea..372869d 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>apache-curator</artifactId>
<groupId>org.apache.curator</groupId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>curator-x-rpc</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<name>Curator RPC Proxy</name>
<description>A proxy that bridges non-java environments with the Curator framework and recipes</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/674f3943/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4fce651..be3ea33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache Curator</name>
@@ -105,7 +105,7 @@
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git
</developerConnection>
- <tag>apache-curator-2.7.1</tag>
+ <tag>HEAD</tag>
</scm>
<issueManagement>
[44/50] curator git commit: If the server successfully creates a
Curator-protected node by crashes before returning to the client,
Curator will incorrectly set the wrong value for the name field in the
background Event causing this problem. 'name' should
Posted by ca...@apache.org.
If the server successfully creates a Curator-protected node by crashes before returning to the client, Curator will incorrectly set the wrong value for the name field in the background Event causing this problem. 'name' should be the full path instead of just the ZNode name
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c805679c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c805679c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c805679c
Branch: refs/heads/CURATOR-154
Commit: c805679c8d4307360710a24cddc071cbbcb5ca75
Parents: c9a5c4a
Author: randgalt <ra...@apache.org>
Authored: Mon Apr 20 20:16:40 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Apr 20 20:16:40 2015 -0500
----------------------------------------------------------------------
.../framework/imps/CreateBuilderImpl.java | 14 +-
.../curator/framework/imps/TestFramework.java | 215 +++++++++----------
.../framework/imps/TestFrameworkEdges.java | 86 +++++++-
3 files changed, 192 insertions(+), 123 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/c805679c/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
index 5244d04..6eef4d4 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
@@ -597,6 +597,9 @@ class CreateBuilderImpl implements CreateBuilder, BackgroundOperation<PathAndByt
};
}
+ @VisibleForTesting
+ volatile boolean debugForceFindProtectedNode = false;
+
private void pathInBackground(final String path, final byte[] data, final String givenPath)
{
final AtomicBoolean firstTime = new AtomicBoolean(true);
@@ -620,9 +623,10 @@ class CreateBuilderImpl implements CreateBuilder, BackgroundOperation<PathAndByt
void callPerformBackgroundOperation() throws Exception
{
boolean callSuper = true;
- boolean localFirstTime = firstTime.getAndSet(false);
+ boolean localFirstTime = firstTime.getAndSet(false) && !debugForceFindProtectedNode;
if ( !localFirstTime && doProtected )
{
+ debugForceFindProtectedNode = false;
String createdPath = null;
try
{
@@ -637,7 +641,7 @@ class CreateBuilderImpl implements CreateBuilder, BackgroundOperation<PathAndByt
{
try
{
- sendBackgroundResponse(KeeperException.Code.OK.intValue(), createdPath, backgrounding.getContext(), ZKPaths.getNodeFromPath(createdPath), this);
+ sendBackgroundResponse(KeeperException.Code.OK.intValue(), createdPath, backgrounding.getContext(), createdPath, this);
}
catch ( Exception e )
{
@@ -676,11 +680,12 @@ class CreateBuilderImpl implements CreateBuilder, BackgroundOperation<PathAndByt
@Override
public String call() throws Exception
{
- boolean localFirstTime = firstTime.getAndSet(false);
+ boolean localFirstTime = firstTime.getAndSet(false) && !debugForceFindProtectedNode;
String createdPath = null;
if ( !localFirstTime && doProtected )
{
+ debugForceFindProtectedNode = false;
createdPath = findProtectedNodeInForeground(path);
}
@@ -751,7 +756,8 @@ class CreateBuilderImpl implements CreateBuilder, BackgroundOperation<PathAndByt
return returnPath;
}
- private String adjustPath(String path) throws Exception
+ @VisibleForTesting
+ String adjustPath(String path) throws Exception
{
if ( doProtected )
{
http://git-wip-us.apache.org/repos/asf/curator/blob/c805679c/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index 0d98f1d..22276e6 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -6,9 +6,9 @@
* 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* 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
@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.curator.framework.imps;
import com.google.common.collect.Lists;
-
import org.apache.curator.framework.AuthInfo;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
@@ -43,7 +43,6 @@ import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import org.testng.Assert;
import org.testng.annotations.Test;
-
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
@@ -55,14 +54,14 @@ import java.util.concurrent.TimeUnit;
public class TestFramework extends BaseClassForTests
{
@Test
- public void testConnectionState() throws Exception
+ public void testConnectionState() throws Exception
{
- Timing timing = new Timing();
- CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+ Timing timing = new Timing();
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
try
{
- final BlockingQueue<ConnectionState> queue = new LinkedBlockingQueue<ConnectionState>();
- ConnectionStateListener listener = new ConnectionStateListener()
+ final BlockingQueue<ConnectionState> queue = new LinkedBlockingQueue<ConnectionState>();
+ ConnectionStateListener listener = new ConnectionStateListener()
{
@Override
public void stateChanged(CuratorFramework client, ConnectionState newState)
@@ -85,15 +84,15 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testNamespaceWithWatcher() throws Exception
+ public void testNamespaceWithWatcher() throws Exception
{
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder.connectString(server.getConnectString()).namespace("aisa").retryPolicy(new RetryOneTime(1)).build();
client.start();
try
{
- final BlockingQueue<String> queue = new LinkedBlockingQueue<String>();
- Watcher watcher = new Watcher()
+ final BlockingQueue<String> queue = new LinkedBlockingQueue<String>();
+ Watcher watcher = new Watcher()
{
@Override
public void process(WatchedEvent event)
@@ -112,7 +111,7 @@ public class TestFramework extends BaseClassForTests
client.getChildren().usingWatcher(watcher).forPath("/base");
client.create().forPath("/base/child");
- String path = queue.take();
+ String path = queue.take();
Assert.assertEquals(path, "/base");
}
finally
@@ -122,15 +121,15 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testNamespaceInBackground() throws Exception
+ public void testNamespaceInBackground() throws Exception
{
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder.connectString(server.getConnectString()).namespace("aisa").retryPolicy(new RetryOneTime(1)).build();
client.start();
try
{
- final BlockingQueue<String> queue = new LinkedBlockingQueue<String>();
- CuratorListener listener = new CuratorListener()
+ final BlockingQueue<String> queue = new LinkedBlockingQueue<String>();
+ CuratorListener listener = new CuratorListener()
{
@Override
public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
@@ -146,12 +145,12 @@ public class TestFramework extends BaseClassForTests
client.create().forPath("/base");
client.checkExists().inBackground().forPath("/base");
- String path = queue.poll(10, TimeUnit.SECONDS);
+ String path = queue.poll(10, TimeUnit.SECONDS);
Assert.assertEquals(path, "/base");
client.getCuratorListenable().removeListener(listener);
- BackgroundCallback callback = new BackgroundCallback()
+ BackgroundCallback callback = new BackgroundCallback()
{
@Override
public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
@@ -170,7 +169,7 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testCreateACLSingleAuth() throws Exception
+ public void testCreateACLSingleAuth() throws Exception
{
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder
@@ -224,10 +223,10 @@ public class TestFramework extends BaseClassForTests
{
client.close();
}
- }
+ }
@Test
- public void testACLDeprecatedApis() throws Exception
+ public void testACLDeprecatedApis() throws Exception
{
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
.connectString(server.getConnectString())
@@ -281,10 +280,10 @@ public class TestFramework extends BaseClassForTests
// Try setting data with me1:pass1
client = builder
- .connectString(server.getConnectString())
- .authorization("digest", "me2:pass2".getBytes())
- .retryPolicy(new RetryOneTime(1))
- .build();
+ .connectString(server.getConnectString())
+ .authorization("digest", "me2:pass2".getBytes())
+ .retryPolicy(new RetryOneTime(1))
+ .build();
client.start();
try
{
@@ -320,7 +319,7 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testCreateACLWithReset() throws Exception
+ public void testCreateACLWithReset() throws Exception
{
Timing timing = new Timing();
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
@@ -381,15 +380,15 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testCreateParents() throws Exception
+ public void testCreateParents() throws Exception
{
- CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
+ CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder.connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).build();
client.start();
try
{
client.create().creatingParentsIfNeeded().forPath("/one/two/three", "foo".getBytes());
- byte[] data = client.getData().forPath("/one/two/three");
+ byte[] data = client.getData().forPath("/one/two/three");
Assert.assertEquals(data, "foo".getBytes());
client.create().creatingParentsIfNeeded().forPath("/one/two/another", "bar".getBytes());
@@ -403,11 +402,11 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testEnsurePathWithNamespace() throws Exception
+ public void testEnsurePathWithNamespace() throws Exception
{
final String namespace = "jz";
- CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
+ CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder.connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).namespace(namespace).build();
client.start();
try
@@ -427,16 +426,16 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testNamespace() throws Exception
+ public void testNamespace() throws Exception
{
final String namespace = "TestNamespace";
-
- CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
+
+ CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder.connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).namespace(namespace).build();
client.start();
try
{
- String actualPath = client.create().forPath("/test");
+ String actualPath = client.create().forPath("/test");
Assert.assertEquals(actualPath, "/test");
Assert.assertNotNull(client.getZookeeperClient().getZooKeeper().exists("/" + namespace + "/test", false));
Assert.assertNull(client.getZookeeperClient().getZooKeeper().exists("/test", false));
@@ -446,7 +445,7 @@ public class TestFramework extends BaseClassForTests
Assert.assertNotNull(client.getZookeeperClient().getZooKeeper().exists("/non", false));
client.create().forPath("/test/child", "hey".getBytes());
- byte[] bytes = client.getData().forPath("/test/child");
+ byte[] bytes = client.getData().forPath("/test/child");
Assert.assertEquals(bytes, "hey".getBytes());
bytes = client.usingNamespace(null).getData().forPath("/" + namespace + "/test/child");
@@ -459,14 +458,14 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testCustomCallback() throws Exception
+ public void testCustomCallback() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
try
{
- final CountDownLatch latch = new CountDownLatch(1);
- BackgroundCallback callback = new BackgroundCallback()
+ final CountDownLatch latch = new CountDownLatch(1);
+ BackgroundCallback callback = new BackgroundCallback()
{
@Override
public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
@@ -490,7 +489,7 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testSync() throws Exception
+ public void testSync() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
@@ -515,7 +514,7 @@ public class TestFramework extends BaseClassForTests
client.create().forPath("/head");
Assert.assertNotNull(client.checkExists().forPath("/head"));
- CountDownLatch latch = new CountDownLatch(1);
+ CountDownLatch latch = new CountDownLatch(1);
client.sync("/head", latch);
Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
}
@@ -526,7 +525,7 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testSyncNew() throws Exception
+ public void testSyncNew() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
@@ -535,7 +534,7 @@ public class TestFramework extends BaseClassForTests
client.create().forPath("/head");
Assert.assertNotNull(client.checkExists().forPath("/head"));
- final CountDownLatch latch = new CountDownLatch(1);
+ final CountDownLatch latch = new CountDownLatch(1);
BackgroundCallback callback = new BackgroundCallback()
{
@Override
@@ -557,32 +556,32 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testBackgroundDelete() throws Exception
+ public void testBackgroundDelete() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
try
{
client.getCuratorListenable().addListener
- (
- new CuratorListener()
- {
- @Override
- public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
+ (
+ new CuratorListener()
{
- if ( event.getType() == CuratorEventType.DELETE )
+ @Override
+ public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
{
- Assert.assertEquals(event.getPath(), "/head");
- ((CountDownLatch)event.getContext()).countDown();
+ if ( event.getType() == CuratorEventType.DELETE )
+ {
+ Assert.assertEquals(event.getPath(), "/head");
+ ((CountDownLatch)event.getContext()).countDown();
+ }
}
}
- }
- );
+ );
client.create().forPath("/head");
Assert.assertNotNull(client.checkExists().forPath("/head"));
- CountDownLatch latch = new CountDownLatch(1);
+ CountDownLatch latch = new CountDownLatch(1);
client.delete().inBackground(latch).forPath("/head");
Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
Assert.assertNull(client.checkExists().forPath("/head"));
@@ -594,7 +593,7 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testBackgroundDeleteWithChildren() throws Exception
+ public void testBackgroundDeleteWithChildren() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
@@ -619,7 +618,7 @@ public class TestFramework extends BaseClassForTests
client.create().creatingParentsIfNeeded().forPath("/one/two/three/four");
Assert.assertNotNull(client.checkExists().forPath("/one/two/three/four"));
- CountDownLatch latch = new CountDownLatch(1);
+ CountDownLatch latch = new CountDownLatch(1);
client.delete().deletingChildrenIfNeeded().inBackground(latch).forPath("/one/two");
Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
Assert.assertNull(client.checkExists().forPath("/one/two"));
@@ -631,7 +630,7 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testDelete() throws Exception
+ public void testDelete() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
@@ -651,7 +650,7 @@ public class TestFramework extends BaseClassForTests
@Test
public void testDeleteWithChildren() throws Exception
{
- CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
+ CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder.connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).build();
client.start();
try
@@ -671,7 +670,7 @@ public class TestFramework extends BaseClassForTests
@Test
public void testDeleteGuaranteedWithChildren() throws Exception
{
- CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
+ CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework client = builder.connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).build();
client.start();
try
@@ -689,7 +688,7 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testGetSequentialChildren() throws Exception
+ public void testGetSequentialChildren() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
@@ -702,7 +701,7 @@ public class TestFramework extends BaseClassForTests
client.create().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).forPath("/head/child");
}
- List<String> children = client.getChildren().forPath("/head");
+ List<String> children = client.getChildren().forPath("/head");
Assert.assertEquals(children.size(), 10);
}
finally
@@ -712,50 +711,50 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testBackgroundGetDataWithWatch() throws Exception
+ public void testBackgroundGetDataWithWatch() throws Exception
{
- final byte[] data1 = {1, 2, 3};
- final byte[] data2 = {4, 5, 6, 7};
+ final byte[] data1 = {1, 2, 3};
+ final byte[] data2 = {4, 5, 6, 7};
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
try
{
- final CountDownLatch watchedLatch = new CountDownLatch(1);
+ final CountDownLatch watchedLatch = new CountDownLatch(1);
client.getCuratorListenable().addListener
- (
- new CuratorListener()
- {
- @Override
- public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
+ (
+ new CuratorListener()
{
- if ( event.getType() == CuratorEventType.GET_DATA )
- {
- Assert.assertEquals(event.getPath(), "/test");
- Assert.assertEquals(event.getData(), data1);
- ((CountDownLatch)event.getContext()).countDown();
- }
- else if ( event.getType() == CuratorEventType.WATCHED )
+ @Override
+ public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
{
- if ( event.getWatchedEvent().getType() == Watcher.Event.EventType.NodeDataChanged )
+ if ( event.getType() == CuratorEventType.GET_DATA )
{
Assert.assertEquals(event.getPath(), "/test");
- watchedLatch.countDown();
+ Assert.assertEquals(event.getData(), data1);
+ ((CountDownLatch)event.getContext()).countDown();
+ }
+ else if ( event.getType() == CuratorEventType.WATCHED )
+ {
+ if ( event.getWatchedEvent().getType() == Watcher.Event.EventType.NodeDataChanged )
+ {
+ Assert.assertEquals(event.getPath(), "/test");
+ watchedLatch.countDown();
+ }
}
}
}
- }
- );
+ );
client.create().forPath("/test", data1);
- CountDownLatch backgroundLatch = new CountDownLatch(1);
+ CountDownLatch backgroundLatch = new CountDownLatch(1);
client.getData().watched().inBackground(backgroundLatch).forPath("/test");
Assert.assertTrue(backgroundLatch.await(10, TimeUnit.SECONDS));
client.setData().forPath("/test", data2);
Assert.assertTrue(watchedLatch.await(10, TimeUnit.SECONDS));
- byte[] checkData = client.getData().forPath("/test");
+ byte[] checkData = client.getData().forPath("/test");
Assert.assertEquals(checkData, data2);
}
finally
@@ -765,29 +764,29 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testBackgroundCreate() throws Exception
+ public void testBackgroundCreate() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
try
{
client.getCuratorListenable().addListener
- (
- new CuratorListener()
- {
- @Override
- public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
+ (
+ new CuratorListener()
{
- if ( event.getType() == CuratorEventType.CREATE )
+ @Override
+ public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
{
- Assert.assertEquals(event.getPath(), "/test");
- ((CountDownLatch)event.getContext()).countDown();
+ if ( event.getType() == CuratorEventType.CREATE )
+ {
+ Assert.assertEquals(event.getPath(), "/test");
+ ((CountDownLatch)event.getContext()).countDown();
+ }
}
}
- }
- );
+ );
- CountDownLatch latch = new CountDownLatch(1);
+ CountDownLatch latch = new CountDownLatch(1);
client.create().inBackground(latch).forPath("/test", new byte[]{1, 2, 3});
Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
}
@@ -798,20 +797,20 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testCreateModes() throws Exception
+ public void testCreateModes() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
try
{
- byte[] writtenBytes = {1, 2, 3};
+ byte[] writtenBytes = {1, 2, 3};
client.create().forPath("/test", writtenBytes); // should be persistent
client.close();
client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
- byte[] readBytes = client.getData().forPath("/test");
+ byte[] readBytes = client.getData().forPath("/test");
Assert.assertEquals(writtenBytes, readBytes);
client.create().withMode(CreateMode.EPHEMERAL).forPath("/ghost", writtenBytes);
@@ -822,10 +821,10 @@ public class TestFramework extends BaseClassForTests
readBytes = client.getData().forPath("/test");
Assert.assertEquals(writtenBytes, readBytes);
- Stat stat = client.checkExists().forPath("/ghost");
+ Stat stat = client.checkExists().forPath("/ghost");
Assert.assertNull(stat);
- String realPath = client.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath("/pseq", writtenBytes);
+ String realPath = client.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath("/pseq", writtenBytes);
Assert.assertNotSame(realPath, "/pseq");
client.close();
@@ -852,13 +851,13 @@ public class TestFramework extends BaseClassForTests
}
@Test
- public void testSimple() throws Exception
+ public void testSimple() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
try
{
- String path = client.create().withMode(CreateMode.PERSISTENT).forPath("/test", new byte[]{1, 2, 3});
+ String path = client.create().withMode(CreateMode.PERSISTENT).forPath("/test", new byte[]{1, 2, 3});
Assert.assertEquals(path, "/test");
}
finally
@@ -866,9 +865,9 @@ public class TestFramework extends BaseClassForTests
client.close();
}
}
-
+
@Test
- public void testSequentialWithTrailingSeparator() throws Exception
+ public void testSequentialWithTrailingSeparator() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
client.start();
@@ -876,12 +875,12 @@ public class TestFramework extends BaseClassForTests
{
client.create().forPath("/test");
//This should create a node in the form of "/test/00000001"
- String path = client.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath("/test/");
+ String path = client.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath("/test/");
Assert.assertTrue(path.startsWith("/test/"));
}
finally
{
client.close();
}
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/curator/blob/c805679c/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
index 9c02c7d..af7ae2b 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
@@ -6,9 +6,9 @@
* 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* 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
@@ -44,6 +44,7 @@ import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.data.Stat;
import org.testng.Assert;
import org.testng.annotations.Test;
+import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
@@ -56,6 +57,69 @@ public class TestFrameworkEdges extends BaseClassForTests
private final Timing timing = new Timing();
@Test
+ public void testPathsFromProtectingInBackground() throws Exception
+ {
+ for ( CreateMode mode : CreateMode.values() )
+ {
+ internalTestPathsFromProtectingInBackground(mode);
+ }
+ }
+
+ private void internalTestPathsFromProtectingInBackground(CreateMode mode) throws Exception
+ {
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), 1, new RetryOneTime(1));
+ try
+ {
+ client.start();
+
+ client.create().creatingParentsIfNeeded().forPath("/a/b/c");
+
+ final BlockingQueue<String> paths = new ArrayBlockingQueue<String>(2);
+ BackgroundCallback callback = new BackgroundCallback()
+ {
+ @Override
+ public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
+ {
+ paths.put(event.getName());
+ paths.put(event.getPath());
+ }
+ };
+ final String TEST_PATH = "/a/b/c/test-";
+ client.create().withMode(mode).inBackground(callback).forPath(TEST_PATH);
+
+ String name1 = paths.take();
+ String path1 = paths.take();
+
+ client.close();
+
+ client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), 1, new RetryOneTime(1));
+ client.start();
+ CreateBuilderImpl createBuilder = (CreateBuilderImpl)client.create().withProtection();
+
+ client.create().forPath(createBuilder.adjustPath(TEST_PATH));
+
+ createBuilder.debugForceFindProtectedNode = true;
+ createBuilder.withMode(mode).inBackground(callback).forPath(TEST_PATH);
+
+ String name2 = paths.take();
+ String path2 = paths.take();
+
+ Assert.assertEquals(ZKPaths.getPathAndNode(name1).getPath(), ZKPaths.getPathAndNode(TEST_PATH).getPath());
+ Assert.assertEquals(ZKPaths.getPathAndNode(name2).getPath(), ZKPaths.getPathAndNode(TEST_PATH).getPath());
+ Assert.assertEquals(ZKPaths.getPathAndNode(path1).getPath(), ZKPaths.getPathAndNode(TEST_PATH).getPath());
+ Assert.assertEquals(ZKPaths.getPathAndNode(path2).getPath(), ZKPaths.getPathAndNode(TEST_PATH).getPath());
+
+ client.delete().deletingChildrenIfNeeded().forPath("/a/b/c");
+ client.delete().forPath("/a/b");
+ client.delete().forPath("/a");
+ }
+ finally
+ {
+ CloseableUtils.closeQuietly(client);
+ }
+ }
+
+ @Test
public void connectionLossWithBackgroundTest() throws Exception
{
CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), 1, new RetryOneTime(1));
@@ -66,20 +130,20 @@ public class TestFrameworkEdges extends BaseClassForTests
client.getZookeeperClient().blockUntilConnectedOrTimedOut();
server.close();
client.getChildren().inBackground
- (
- new BackgroundCallback()
- {
- public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
+ (
+ new BackgroundCallback()
{
- latch.countDown();
+ public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
+ {
+ latch.countDown();
+ }
}
- }
- ).forPath("/");
+ ).forPath("/");
Assert.assertTrue(timing.awaitLatch(latch));
}
finally
{
- client.close();
+ CloseableUtils.closeQuietly(client);
}
}
[39/50] curator git commit: doc update
Posted by ca...@apache.org.
doc update
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/dd03a631
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/dd03a631
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/dd03a631
Branch: refs/heads/CURATOR-154
Commit: dd03a63132e5ffe97dba7f1a5b80d72e04a544e7
Parents: 7fe94bb
Author: randgalt <ra...@apache.org>
Authored: Mon Apr 6 17:27:45 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Apr 6 17:27:45 2015 -0500
----------------------------------------------------------------------
.../org/apache/curator/framework/recipes/locks/ChildReaper.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/dd03a631/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
index ee5c414..a0a3fd0 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
@@ -219,7 +219,7 @@ public class ChildReaper implements Closeable
* If a node has so many children that {@link CuratorFramework#getChildren()} will fail
* (due to jute.maxbuffer) it can cause connection instability. Set the max number of
* children here to prevent the path from being queried in these cases. The number should usually
- * be: avergage-node-name/1000000
+ * be: average-node-name-length/1000000
*
* @param maxChildren max children
*/
[18/50] curator git commit: Retain previous methods for backward
compatibility
Posted by ca...@apache.org.
Retain previous methods for backward compatibility
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9ccf2a3f
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9ccf2a3f
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9ccf2a3f
Branch: refs/heads/CURATOR-154
Commit: 9ccf2a3f7d5fb3808ede3c2a99af8d358b40815e
Parents: 5832891
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 13 07:45:04 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jan 13 07:45:04 2015 -0500
----------------------------------------------------------------------
.../framework/CuratorFrameworkFactory.java | 52 +++++++++++++++++---
1 file changed, 46 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/9ccf2a3f/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 314d669..317426d 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
@@ -19,9 +19,8 @@
package org.apache.curator.framework;
+import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
import org.apache.curator.RetryPolicy;
import org.apache.curator.ensemble.EnsembleProvider;
import org.apache.curator.ensemble.fixed.FixedEnsembleProvider;
@@ -36,7 +35,6 @@ import org.apache.curator.utils.DefaultZookeeperFactory;
import org.apache.curator.utils.ZookeeperFactory;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
-
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -166,9 +164,7 @@ public class CuratorFrameworkFactory
*/
public Builder authorization(String scheme, byte[] auth)
{
- this.authInfos = Lists.newArrayList();
- this.authInfos.add(new AuthInfo(scheme, (auth != null) ? Arrays.copyOf(auth, auth.length) : null));
- return this;
+ return authorization(ImmutableList.of(new AuthInfo(scheme, (auth != null) ? Arrays.copyOf(auth, auth.length) : null)));
}
/**
@@ -383,6 +379,50 @@ public class CuratorFrameworkFactory
return namespace;
}
+ @Deprecated
+ public String getAuthScheme()
+ {
+ switch ( authInfos.size() )
+ {
+ case 0:
+ {
+ return null;
+ }
+
+ case 1:
+ {
+ return authInfos.get(0).scheme;
+ }
+
+ default:
+ {
+ throw new IllegalStateException("More than 1 auth has been added");
+ }
+ }
+ }
+
+ @Deprecated
+ public byte[] getAuthValue()
+ {
+ switch ( authInfos.size() )
+ {
+ case 0:
+ {
+ return null;
+ }
+
+ case 1:
+ {
+ return authInfos.get(0).getAuth();
+ }
+
+ default:
+ {
+ throw new IllegalStateException("More than 1 auth has been added");
+ }
+ }
+ }
+
public List<AuthInfo> getAuthInfos()
{
return authInfos;
[42/50] curator git commit: Guaranteed deletes must accept
InterruptedException as well as retryable exceptions
Posted by ca...@apache.org.
Guaranteed deletes must accept InterruptedException as well as retryable exceptions
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/989f9414
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/989f9414
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/989f9414
Branch: refs/heads/CURATOR-154
Commit: 989f94148faae97f23368e4b5bae2f1f03eaa62c
Parents: 6a56c51
Author: randgalt <ra...@apache.org>
Authored: Sun Apr 19 13:13:45 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Apr 19 13:13:45 2015 -0500
----------------------------------------------------------------------
.../framework/imps/DeleteBuilderImpl.java | 110 ++++++++++---------
.../recipes/leader/TestLeaderSelector.java | 67 +++++++++++
2 files changed, 127 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/989f9414/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
index 5d8b846..c067357 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
@@ -6,9 +6,9 @@
* 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* 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
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.curator.framework.imps;
import org.apache.curator.RetryLoop;
@@ -40,11 +41,11 @@ import java.util.concurrent.Executor;
class DeleteBuilderImpl implements DeleteBuilder, BackgroundOperation<String>
{
- private final CuratorFrameworkImpl client;
- private int version;
- private Backgrounding backgrounding;
- private boolean deletingChildrenIfNeeded;
- private boolean guaranteed;
+ private final CuratorFrameworkImpl client;
+ private int version;
+ private Backgrounding backgrounding;
+ private boolean deletingChildrenIfNeeded;
+ private boolean guaranteed;
DeleteBuilderImpl(CuratorFrameworkImpl client)
{
@@ -55,14 +56,14 @@ class DeleteBuilderImpl implements DeleteBuilder, BackgroundOperation<String>
guaranteed = false;
}
- TransactionDeleteBuilder asTransactionDeleteBuilder(final CuratorTransactionImpl curatorTransaction, final CuratorMultiTransactionRecord transaction)
+ TransactionDeleteBuilder asTransactionDeleteBuilder(final CuratorTransactionImpl curatorTransaction, final CuratorMultiTransactionRecord transaction)
{
return new TransactionDeleteBuilder()
{
@Override
public CuratorTransactionBridge forPath(String path) throws Exception
{
- String fixedPath = client.fixForNamespace(path);
+ String fixedPath = client.fixForNamespace(path);
transaction.add(Op.delete(fixedPath, version), OperationType.DELETE, path);
return curatorTransaction;
}
@@ -142,32 +143,35 @@ class DeleteBuilderImpl implements DeleteBuilder, BackgroundOperation<String>
@Override
public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception
{
- final TimeTrace trace = client.getZookeeperClient().startTracer("DeleteBuilderImpl-Background");
+ final TimeTrace trace = client.getZookeeperClient().startTracer("DeleteBuilderImpl-Background");
client.getZooKeeper().delete
- (
- operationAndData.getData(),
- version,
- new AsyncCallback.VoidCallback()
- {
- @Override
- public void processResult(int rc, String path, Object ctx)
+ (
+ operationAndData.getData(),
+ version,
+ new AsyncCallback.VoidCallback()
{
- trace.commit();
- if ((rc == KeeperException.Code.NOTEMPTY.intValue()) && deletingChildrenIfNeeded) {
- backgroundDeleteChildrenThenNode(operationAndData);
- } else {
- CuratorEvent event = new CuratorEventImpl(client, CuratorEventType.DELETE, rc, path, null, ctx, null, null, null, null, null);
- client.processBackgroundOperation(operationAndData, event);
+ @Override
+ public void processResult(int rc, String path, Object ctx)
+ {
+ trace.commit();
+ if ( (rc == KeeperException.Code.NOTEMPTY.intValue()) && deletingChildrenIfNeeded )
+ {
+ backgroundDeleteChildrenThenNode(operationAndData);
+ }
+ else
+ {
+ CuratorEvent event = new CuratorEventImpl(client, CuratorEventType.DELETE, rc, path, null, ctx, null, null, null, null, null);
+ client.processBackgroundOperation(operationAndData, event);
+ }
}
- }
- },
- backgrounding.getContext()
- );
+ },
+ backgrounding.getContext()
+ );
}
private void backgroundDeleteChildrenThenNode(final OperationAndData<String> mainOperationAndData)
{
- BackgroundOperation<String> operation = new BackgroundOperation<String>()
+ BackgroundOperation<String> operation = new BackgroundOperation<String>()
{
@Override
public void performBackgroundOperation(OperationAndData<String> dummy) throws Exception
@@ -190,12 +194,12 @@ class DeleteBuilderImpl implements DeleteBuilder, BackgroundOperation<String>
@Override
public Void forPath(String path) throws Exception
{
- final String unfixedPath = path;
+ final String unfixedPath = path;
path = client.fixForNamespace(path);
if ( backgrounding.inBackground() )
{
- OperationAndData.ErrorCallback<String> errorCallback = null;
+ OperationAndData.ErrorCallback<String> errorCallback = null;
if ( guaranteed )
{
errorCallback = new OperationAndData.ErrorCallback<String>()
@@ -223,35 +227,41 @@ class DeleteBuilderImpl implements DeleteBuilder, BackgroundOperation<String>
private void pathInForeground(final String path, String unfixedPath) throws Exception
{
- TimeTrace trace = client.getZookeeperClient().startTracer("DeleteBuilderImpl-Foreground");
+ TimeTrace trace = client.getZookeeperClient().startTracer("DeleteBuilderImpl-Foreground");
try
{
RetryLoop.callWithRetry
- (
- client.getZookeeperClient(),
- new Callable<Void>()
- {
- @Override
- public Void call() throws Exception
+ (
+ client.getZookeeperClient(),
+ new Callable<Void>()
{
- try {
- client.getZooKeeper().delete(path, version);
- } catch (KeeperException.NotEmptyException e) {
- if (deletingChildrenIfNeeded) {
- ZKPaths.deleteChildren(client.getZooKeeper(), path, true);
- } else {
- throw e;
+ @Override
+ public Void call() throws Exception
+ {
+ try
+ {
+ client.getZooKeeper().delete(path, version);
}
+ catch ( KeeperException.NotEmptyException e )
+ {
+ if ( deletingChildrenIfNeeded )
+ {
+ ZKPaths.deleteChildren(client.getZooKeeper(), path, true);
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ return null;
}
- return null;
}
- }
- );
- }
+ );
+ }
catch ( Exception e )
{
//Only retry a guaranteed delete if it's a retryable error
- if( RetryLoop.isRetryException(e) && guaranteed )
+ if( (RetryLoop.isRetryException(e) || (e instanceof InterruptedException)) && guaranteed )
{
client.getFailedDeleteManager().addFailedDelete(unfixedPath);
}
http://git-wip-us.apache.org/repos/asf/curator/blob/989f9414/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java
index ec909f7..c7f415c 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java
@@ -23,6 +23,7 @@ import com.google.common.collect.Lists;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.state.ConnectionState;
+import org.apache.curator.framework.state.ConnectionStateListener;
import org.apache.curator.retry.RetryOneTime;
import org.apache.curator.test.BaseClassForTests;
import org.apache.curator.test.KillSession;
@@ -34,6 +35,7 @@ import org.testng.annotations.Test;
import org.testng.internal.annotations.Sets;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
@@ -48,6 +50,71 @@ public class TestLeaderSelector extends BaseClassForTests
private static final String PATH_NAME = "/one/two/me";
@Test
+ public void testLeaderNodeDeleteOnInterrupt() throws Exception
+ {
+ Timing timing = new Timing();
+ LeaderSelector selector = null;
+ CuratorFramework client = null;
+ try
+ {
+ client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+ final CountDownLatch reconnectedLatch = new CountDownLatch(1);
+ ConnectionStateListener connectionStateListener = new ConnectionStateListener()
+ {
+ @Override
+ public void stateChanged(CuratorFramework client, ConnectionState newState)
+ {
+ if ( newState == ConnectionState.RECONNECTED )
+ {
+ reconnectedLatch.countDown();
+ }
+ }
+ };
+ client.getConnectionStateListenable().addListener(connectionStateListener);
+ client.start();
+
+ final BlockingQueue<Thread> queue = new ArrayBlockingQueue<Thread>(1);
+ LeaderSelectorListener listener = new LeaderSelectorListener()
+ {
+ @Override
+ public void takeLeadership(CuratorFramework client) throws Exception
+ {
+ queue.add(Thread.currentThread());
+ try
+ {
+ Thread.currentThread().join();
+ }
+ catch ( InterruptedException e )
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ @Override
+ public void stateChanged(CuratorFramework client, ConnectionState newState)
+ {
+ }
+ };
+ selector = new LeaderSelector(client, "/leader", listener);
+ selector.start();
+
+ Thread leaderThread = queue.take();
+ server.stop();
+ leaderThread.interrupt();
+ server.restart();
+ Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
+ timing.sleepABit();
+
+ Assert.assertEquals(client.getChildren().forPath("/leader").size(), 0);
+ }
+ finally
+ {
+ CloseableUtils.closeQuietly(selector);
+ CloseableUtils.closeQuietly(client);
+ }
+ }
+
+ @Test
public void testInterruptLeadershipWithRequeue() throws Exception
{
Timing timing = new Timing();
[16/50] curator git commit: [maven-release-plugin] prepare release
apache-curator-2.7.1
Posted by ca...@apache.org.
[maven-release-plugin] prepare release apache-curator-2.7.1
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f68a0d66
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f68a0d66
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f68a0d66
Branch: refs/heads/CURATOR-154
Commit: f68a0d66c843b0115aac6c9c18ccedc851facf43
Parents: 169b610
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 21:56:00 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 21:56:00 2015 -0500
----------------------------------------------------------------------
curator-client/pom.xml | 4 ++--
curator-examples/pom.xml | 2 +-
curator-framework/pom.xml | 4 ++--
curator-recipes/pom.xml | 4 ++--
curator-test/pom.xml | 4 ++--
curator-x-discovery-server/pom.xml | 4 ++--
curator-x-discovery/pom.xml | 4 ++--
curator-x-rpc/pom.xml | 4 ++--
pom.xml | 4 ++--
9 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index cd0af80..b21ab7e 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-client</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Client</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index 1728ec9..8a55dc0 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-examples</artifactId>
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index 446c2fd..f5b309d 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-framework</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Framework</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 4955dde..348cc48 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-recipes</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Recipes</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 5b6352a..67bac8c 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-test</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<name>Curator Testing</name>
<description>Unit testing utilities.</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index f6851be..fcbbafa 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-x-discovery-server</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery Server</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index 69d8410..1688ae2 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<artifactId>curator-x-discovery</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 0e0b528..749deea 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>apache-curator</artifactId>
<groupId>org.apache.curator</groupId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>curator-x-rpc</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<name>Curator RPC Proxy</name>
<description>A proxy that bridges non-java environments with the Curator framework and recipes</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/f68a0d66/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3f2d4f9..4fce651 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1-SNAPSHOT</version>
+ <version>2.7.1</version>
<packaging>pom</packaging>
<name>Apache Curator</name>
@@ -105,7 +105,7 @@
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git
</developerConnection>
- <tag>HEAD</tag>
+ <tag>apache-curator-2.7.1</tag>
</scm>
<issueManagement>
[20/50] curator git commit: Merge branch 'CURATOR-111'
Posted by ca...@apache.org.
Merge branch 'CURATOR-111'
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/5ded39fa
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/5ded39fa
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/5ded39fa
Branch: refs/heads/CURATOR-154
Commit: 5ded39fa529f4359032fced16a7a537f538b2598
Parents: 674f394 9d61c12
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 13 07:49:21 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jan 13 07:49:21 2015 -0500
----------------------------------------------------------------------
.../framework/CuratorFrameworkFactory.java | 47 +++++++++++--
.../framework/imps/CuratorFrameworkImpl.java | 4 --
.../curator/framework/imps/TestFramework.java | 73 +++++++++++++++-----
3 files changed, 97 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/5ded39fa/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/5ded39fa/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
[27/50] curator git commit: TreeCache: Fix case where root is deleted
and recraated.
Posted by ca...@apache.org.
TreeCache: Fix case where root is deleted and recraated.
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/febfceca
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/febfceca
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/febfceca
Branch: refs/heads/CURATOR-154
Commit: febfceca0b7409136a16d51d211212dea621cdc5
Parents: d3c5c36
Author: Scott Blum <dr...@apache.org>
Authored: Fri Jan 16 00:24:14 2015 -0500
Committer: Scott Blum <dr...@apache.org>
Committed: Fri Jan 16 00:24:14 2015 -0500
----------------------------------------------------------------------
.../framework/recipes/cache/TreeCache.java | 2 +-
.../framework/recipes/cache/TestTreeCache.java | 24 ++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/febfceca/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
index fbe51df..41fc574 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
@@ -292,7 +292,7 @@ public class TreeCache implements Closeable
if ( parent == null )
{
// Root node; use an exist query to watch for existence.
- client.checkExists().usingWatcher(this).inBackground().forPath(path);
+ client.checkExists().usingWatcher(this).inBackground(this).forPath(path);
}
else
{
http://git-wip-us.apache.org/repos/asf/curator/blob/febfceca/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
index 394428e..467f32b 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
@@ -325,6 +325,30 @@ public class TestTreeCache extends BaseTestTreeCache
}
@Test
+ public void testDeleteThenCreateRoot() throws Exception
+ {
+ client.create().forPath("/test");
+ client.create().forPath("/test/foo", "one".getBytes());
+
+ cache = newTreeCacheWithListeners(client, "/test/foo");
+ cache.start();
+ assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo");
+ assertEvent(TreeCacheEvent.Type.INITIALIZED);
+
+ client.delete().forPath("/test/foo");
+ assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/foo");
+ client.create().forPath("/test/foo", "two".getBytes());
+ assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo");
+
+ client.delete().forPath("/test/foo");
+ assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/foo");
+ client.create().forPath("/test/foo", "two".getBytes());
+ assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo");
+
+ assertNoMoreEvents();
+ }
+
+ @Test
public void testKilledSession() throws Exception
{
client.create().forPath("/test");
[30/50] curator git commit: Reaper now sets its initial
reapingIsActive state based on the state of the leader latch in case the
leader latch was already started before being passed into the reaper's
constructor
Posted by ca...@apache.org.
Reaper now sets its initial reapingIsActive state based on the state of the leader latch in case the leader latch was already started before being passed into the reaper's constructor
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9da79604
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9da79604
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9da79604
Branch: refs/heads/CURATOR-154
Commit: 9da79604bfe7e775d1d42a25f0ac7579b8ee0464
Parents: 520ae54
Author: David Kesler <dk...@yodle.com>
Authored: Mon Feb 9 13:25:51 2015 -0500
Committer: David Kesler <dk...@yodle.com>
Committed: Mon Feb 9 13:25:51 2015 -0500
----------------------------------------------------------------------
.../java/org/apache/curator/framework/recipes/locks/Reaper.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/9da79604/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
index 660e3d3..efd363f 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
@@ -336,7 +336,6 @@ public class Reaper implements Closeable
private void addListenerToLeaderLatch(LeaderLatch leaderLatch)
{
- reapingIsActive.set(false);
LeaderLatchListener listener = new LeaderLatchListener()
{
@@ -357,6 +356,8 @@ public class Reaper implements Closeable
}
};
leaderLatch.addListener(listener);
+
+ reapingIsActive.set(leaderLatch.hasLeadership());
}
private static LeaderLatch makeLeaderLatchIfPathNotNull(CuratorFramework client, String leaderPath)
[13/50] curator git commit: [maven-release-plugin] prepare for next
development iteration
Posted by ca...@apache.org.
[maven-release-plugin] prepare for next development iteration
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/3dc0c0ca
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/3dc0c0ca
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/3dc0c0ca
Branch: refs/heads/CURATOR-154
Commit: 3dc0c0cac7334cbbb0a7fb3694c12dd408fa2eed
Parents: c249053
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 21:35:20 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 21:35:20 2015 -0500
----------------------------------------------------------------------
curator-client/pom.xml | 4 ++--
curator-examples/pom.xml | 2 +-
curator-framework/pom.xml | 4 ++--
curator-recipes/pom.xml | 4 ++--
curator-test/pom.xml | 4 ++--
curator-x-discovery-server/pom.xml | 4 ++--
curator-x-discovery/pom.xml | 4 ++--
curator-x-rpc/pom.xml | 4 ++--
pom.xml | 4 ++--
9 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index b21ab7e..251d2b0 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-client</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Client</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index 8a55dc0..96ea4b1 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-examples</artifactId>
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index f5b309d..67f514f 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-framework</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Framework</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 348cc48..3ce7d63 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-recipes</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Recipes</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 67bac8c..153db7b 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-test</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<name>Curator Testing</name>
<description>Unit testing utilities.</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index fcbbafa..6035681 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery-server</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery Server</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index 1688ae2..b557211 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -24,11 +24,11 @@
<parent>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<artifactId>curator-x-discovery</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Curator Service Discovery</name>
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/curator-x-rpc/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-rpc/pom.xml b/curator-x-rpc/pom.xml
index 749deea..372869d 100644
--- a/curator-x-rpc/pom.xml
+++ b/curator-x-rpc/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>apache-curator</artifactId>
<groupId>org.apache.curator</groupId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>curator-x-rpc</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<name>Curator RPC Proxy</name>
<description>A proxy that bridges non-java environments with the Curator framework and recipes</description>
http://git-wip-us.apache.org/repos/asf/curator/blob/3dc0c0ca/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4fce651..be3ea33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
- <version>2.7.1</version>
+ <version>2.7.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache Curator</name>
@@ -105,7 +105,7 @@
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/curator.git
</developerConnection>
- <tag>apache-curator-2.7.1</tag>
+ <tag>HEAD</tag>
</scm>
<issueManagement>
[43/50] curator git commit: fixed bad header
Posted by ca...@apache.org.
fixed bad header
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c9a5c4a2
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c9a5c4a2
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c9a5c4a2
Branch: refs/heads/CURATOR-154
Commit: c9a5c4a234efa7bb684b68452f105dc7dc3cfd09
Parents: 989f941
Author: randgalt <ra...@apache.org>
Authored: Sun Apr 19 14:20:19 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Apr 19 14:20:19 2015 -0500
----------------------------------------------------------------------
.../org/apache/curator/framework/imps/DeleteBuilderImpl.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/c9a5c4a2/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
index c067357..9db0013 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
@@ -6,9 +6,9 @@
* 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
+ * 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
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.curator.framework.imps;
import org.apache.curator.RetryLoop;
[48/50] curator git commit: Merge branch 'CURATOR-204' of
github.com:madrob/curator into CURATOR-204
Posted by ca...@apache.org.
Merge branch 'CURATOR-204' of github.com:madrob/curator into CURATOR-204
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/5b24948d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/5b24948d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/5b24948d
Branch: refs/heads/CURATOR-154
Commit: 5b24948d2385d24132f1059d5bb52f6452e598b6
Parents: 2347b57 6f505c2
Author: randgalt <ra...@apache.org>
Authored: Tue Apr 21 11:17:24 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Apr 21 11:17:24 2015 -0500
----------------------------------------------------------------------
pom.xml | 60 +-----------------------------------------------------------
1 file changed, 1 insertion(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/5b24948d/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index 01592c7,3053832..14a66df
--- a/pom.xml
+++ b/pom.xml
@@@ -62,21 -62,12 +62,12 @@@
<!-- versions -->
<maven-project-info-reports-plugin-version>2.7</maven-project-info-reports-plugin-version>
- <maven-javadoc-plugin-version>2.9.1</maven-javadoc-plugin-version>
- <maven-dependency-plugin-version>2.8</maven-dependency-plugin-version>
- <maven-install-plugin-version>2.5.1</maven-install-plugin-version>
- <maven-compiler-plugin-version>3.1</maven-compiler-plugin-version>
<maven-bundle-plugin-version>2.3.7</maven-bundle-plugin-version>
- <maven-surefire-plugin-version>2.17</maven-surefire-plugin-version>
- <maven-site-plugin-version>3.3</maven-site-plugin-version>
<doxia-module-confluence-version>1.5</doxia-module-confluence-version>
- <maven-scm-publish-plugin-version>1.0</maven-scm-publish-plugin-version>
<maven-license-plugin-version>1.9.0</maven-license-plugin-version>
- <maven-release-plugin-version>2.5</maven-release-plugin-version>
- <apache-rat-plugin-version>0.10</apache-rat-plugin-version>
<javassist-version>3.18.1-GA</javassist-version>
<commons-math-version>2.2</commons-math-version>
- <jackson-mapper-asl-version>1.9.13</jackson-mapper-asl-version>
+ <jackson-version>2.3.2</jackson-version>
<jersey-version>1.18.1</jersey-version>
<jsr311-api-version>1.1.1</jsr311-api-version>
<jetty-version>6.1.26</jetty-version>
[02/50] curator git commit: Look for connection errors and merely log
when starting. Also, reset instances on initial connection
Posted by ca...@apache.org.
Look for connection errors and merely log when starting. Also, reset instances on initial connection
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/94fce2ca
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/94fce2ca
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/94fce2ca
Branch: refs/heads/CURATOR-154
Commit: 94fce2ca94f827cd3d3c793dbf044bff39ef52a7
Parents: 40b2cd8
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 15:28:56 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 15:28:56 2015 -0500
----------------------------------------------------------------------
.../discovery/details/ServiceDiscoveryImpl.java | 11 +++++--
.../x/discovery/TestServiceDiscovery.java | 33 ++++++++++++++++++++
2 files changed, 42 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/94fce2ca/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
index 3a92e7a..6472262 100644
--- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
+++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
@@ -69,7 +69,7 @@ public class ServiceDiscoveryImpl<T> implements ServiceDiscovery<T>
@Override
public void stateChanged(CuratorFramework client, ConnectionState newState)
{
- if ( newState == ConnectionState.RECONNECTED )
+ if ( (newState == ConnectionState.RECONNECTED) || (newState == ConnectionState.CONNECTED) )
{
try
{
@@ -111,8 +111,15 @@ public class ServiceDiscoveryImpl<T> implements ServiceDiscovery<T>
@Override
public void start() throws Exception
{
+ try
+ {
+ reRegisterServices();
+ }
+ catch ( KeeperException e )
+ {
+ log.error("Could not register instances - will try again later", e);
+ }
client.getConnectionStateListenable().addListener(connectionStateListener);
- reRegisterServices();
}
@Override
http://git-wip-us.apache.org/repos/asf/curator/blob/94fce2ca/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
index 0465599..6eb9ebb 100644
--- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
+++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
@@ -264,4 +264,37 @@ public class TestServiceDiscovery extends BaseClassForTests
}
}
}
+
+ @Test
+ public void testNoServerOnStart() throws Exception
+ {
+ server.stop();
+ List<Closeable> closeables = Lists.newArrayList();
+ try
+ {
+ CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+ closeables.add(client);
+ client.start();
+
+ ServiceInstance<String> instance = ServiceInstance.<String>builder().payload("thing").name("test").port(10064).build();
+ ServiceDiscovery<String> discovery = ServiceDiscoveryBuilder.builder(String.class).basePath("/test").client(client).thisInstance(instance).build();
+ closeables.add(discovery);
+ discovery.start();
+
+ server.restart();
+ Assert.assertEquals(discovery.queryForNames(), Arrays.asList("test"));
+
+ List<ServiceInstance<String>> list = Lists.newArrayList();
+ list.add(instance);
+ Assert.assertEquals(discovery.queryForInstances("test"), list);
+ }
+ finally
+ {
+ Collections.reverse(closeables);
+ for ( Closeable c : closeables )
+ {
+ CloseableUtils.closeQuietly(c);
+ }
+ }
+ }
}
[26/50] curator git commit: TestTreeCache: test double remove and add
Posted by ca...@apache.org.
TestTreeCache: test double remove and add
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d3c5c366
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d3c5c366
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d3c5c366
Branch: refs/heads/CURATOR-154
Commit: d3c5c366f8d8a7ca88983738ea59e31b579684d2
Parents: 383c9ae
Author: Scott Blum <dr...@apache.org>
Authored: Thu Jan 15 14:12:29 2015 -0500
Committer: Scott Blum <dr...@apache.org>
Committed: Thu Jan 15 14:12:29 2015 -0500
----------------------------------------------------------------------
.../apache/curator/framework/recipes/cache/TestTreeCache.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/d3c5c366/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
index 777f416..394428e 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
@@ -316,6 +316,11 @@ public class TestTreeCache extends BaseTestTreeCache
client.create().forPath("/test/foo", "two".getBytes());
assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo");
+ client.delete().forPath("/test/foo");
+ assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/foo");
+ client.create().forPath("/test/foo", "two".getBytes());
+ assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo");
+
assertNoMoreEvents();
}
[09/50] curator git commit: If a service is updated,
update the services map. Closes #43
Posted by ca...@apache.org.
If a service is updated, update the services map. Closes #43
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/dad2888c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/dad2888c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/dad2888c
Branch: refs/heads/CURATOR-154
Commit: dad2888c7f8ffc2203f21f54cc27c93e7576c5e1
Parents: 7fc3e65
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 12 16:11:55 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 12 16:11:55 2015 -0500
----------------------------------------------------------------------
.../apache/curator/x/discovery/details/ServiceDiscoveryImpl.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/dad2888c/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
index 6472262..41c5d77 100644
--- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
+++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
@@ -192,6 +192,7 @@ public class ServiceDiscoveryImpl<T> implements ServiceDiscovery<T>
byte[] bytes = serializer.serialize(service);
String path = pathForInstance(service.getName(), service.getId());
client.setData().forPath(path, bytes);
+ services.put(service.getId(), service);
}
@VisibleForTesting