curator git commit: license
Repository: curator Updated Branches: refs/heads/master 37dc44785 - f17b46fe7 license Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f17b46fe Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f17b46fe Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f17b46fe Branch: refs/heads/master Commit: f17b46fe75fbaba5197581cb3b4fc18571496ffc Parents: 37dc447 Author: randgalt randg...@apache.org Authored: Mon Jan 5 10:07:39 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Jan 5 10:07:39 2015 -0500 -- .../x/discovery/details/TestWatchedInstances.java | 18 ++ 1 file changed, 18 insertions(+) -- http://git-wip-us.apache.org/repos/asf/curator/blob/f17b46fe/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestWatchedInstances.java -- diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestWatchedInstances.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestWatchedInstances.java index 0a19b41..2d03c47 100644 --- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestWatchedInstances.java +++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestWatchedInstances.java @@ -1,3 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.curator.x.discovery.details; import com.google.common.collect.Lists;
curator git commit: Added method to provide old behavior
Repository: curator Updated Branches: refs/heads/CURATOR-177 870b658e5 - 40b2cd802 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-177 Commit: 40b2cd80206fc4b9327f5033d0873375a8706c4a Parents: 870b658 Author: randgalt randg...@apache.org Authored: Mon Jan 12 14:37:20 2015 -0500 Committer: randgalt randg...@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)
[3/4] curator git commit: Added method to provide old behavior
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/870b658e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/870b658e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/870b658e Branch: refs/heads/master Commit: 870b658e54969ec49fa221b45b2a2aa6d016705d Parents: 4a394d5 Author: randgalt randg...@apache.org Authored: Mon Jan 12 14:36:13 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Jan 12 14:36:13 2015 -0500 -- .../src/main/java/org/apache/curator/utils/ThreadUtils.java | 8 .../curator/framework/imps/CuratorTempFrameworkImpl.java | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/870b658e/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 8b1fbfb..ca1080d 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 @@ -54,6 +54,14 @@ public class ThreadUtils .build(); } +public static ThreadFactory newGenericThreadFactory(String processName) +{ +return new ThreadFactoryBuilder() +.setNameFormat(processName + -%d) +.setDaemon(true) +.build(); +} + public static String getProcessName(Class? clazz) { if ( clazz.isAnonymousClass() ) http://git-wip-us.apache.org/repos/asf/curator/blob/870b658e/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java -- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java index 3010f75..d5baa80 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java @@ -25,6 +25,7 @@ import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.CuratorTempFramework; import org.apache.curator.framework.api.TempGetDataBuilder; import org.apache.curator.framework.api.transaction.CuratorTransaction; +import org.apache.curator.utils.ThreadUtils; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; @@ -102,9 +103,7 @@ public class CuratorTempFrameworkImpl implements CuratorTempFramework if (threadFactory == null) { -threadFactory = new ThreadFactoryBuilder() -.setNameFormat(CuratorTempFrameworkImpl-%d) -.build(); +threadFactory = ThreadUtils.newGenericThreadFactory(CuratorTempFrameworkImpl); } cleanup = Executors.newScheduledThreadPool(1, threadFactory);
[1/4] curator git commit: Use Curator in thread names.
Repository: curator Updated Branches: refs/heads/master e8b2c270b - 40b2cd802 Use Curator in thread names. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/075f3fa8 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/075f3fa8 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/075f3fa8 Branch: refs/heads/master Commit: 075f3fa8618545bfe31ac5fca4160c297dcc5028 Parents: 3eea676 Author: Jesse Wilson jwil...@squareup.com Authored: Fri Jan 2 11:55:12 2015 -0500 Committer: Jesse Wilson jwil...@squareup.com Committed: Mon Jan 5 15:16:35 2015 -0500 -- .../main/java/org/apache/curator/utils/ThreadUtils.java | 2 +- .../curator/framework/imps/CuratorFrameworkImpl.java | 2 +- .../curator/framework/imps/CuratorTempFrameworkImpl.java | 11 ++- 3 files changed, 12 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/075f3fa8/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 9665dfe..8b1fbfb 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 @@ -49,7 +49,7 @@ public class ThreadUtils public static ThreadFactory newThreadFactory(String processName) { return new ThreadFactoryBuilder() -.setNameFormat(processName + -%d) +.setNameFormat(Curator- + processName + -%d) .setDaemon(true) .build(); } http://git-wip-us.apache.org/repos/asf/curator/blob/075f3fa8/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 cf38e21..fc462d4 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 @@ -174,7 +174,7 @@ public class CuratorFrameworkImpl implements CuratorFramework ThreadFactory threadFactory = builder.getThreadFactory(); if ( threadFactory == null ) { -threadFactory = ThreadUtils.newThreadFactory(CuratorFramework); +threadFactory = ThreadUtils.newThreadFactory(Framework); } return threadFactory; } http://git-wip-us.apache.org/repos/asf/curator/blob/075f3fa8/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java -- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java index 01204d9..3010f75 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java @@ -19,6 +19,7 @@ package org.apache.curator.framework.imps; import com.google.common.annotations.VisibleForTesting; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.curator.utils.CloseableUtils; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.CuratorTempFramework; @@ -98,7 +99,15 @@ public class CuratorTempFrameworkImpl implements CuratorTempFramework if ( cleanup == null ) { ThreadFactory threadFactory = factory.getThreadFactory(); -cleanup = (threadFactory != null) ? Executors.newScheduledThreadPool(1, threadFactory) : Executors.newScheduledThreadPool(1); + +if (threadFactory == null) +{ +threadFactory = new ThreadFactoryBuilder() +.setNameFormat(CuratorTempFrameworkImpl-%d) +.build(); +} + +cleanup = Executors.newScheduledThreadPool(1, threadFactory); Runnablecommand = new Runnable() {
[1/3] curator git commit: Use Curator in thread names.
Repository: curator Updated Branches: refs/heads/CURATOR-177 [created] 870b658e5 Use Curator in thread names. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/075f3fa8 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/075f3fa8 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/075f3fa8 Branch: refs/heads/CURATOR-177 Commit: 075f3fa8618545bfe31ac5fca4160c297dcc5028 Parents: 3eea676 Author: Jesse Wilson jwil...@squareup.com Authored: Fri Jan 2 11:55:12 2015 -0500 Committer: Jesse Wilson jwil...@squareup.com Committed: Mon Jan 5 15:16:35 2015 -0500 -- .../main/java/org/apache/curator/utils/ThreadUtils.java | 2 +- .../curator/framework/imps/CuratorFrameworkImpl.java | 2 +- .../curator/framework/imps/CuratorTempFrameworkImpl.java | 11 ++- 3 files changed, 12 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/075f3fa8/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 9665dfe..8b1fbfb 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 @@ -49,7 +49,7 @@ public class ThreadUtils public static ThreadFactory newThreadFactory(String processName) { return new ThreadFactoryBuilder() -.setNameFormat(processName + -%d) +.setNameFormat(Curator- + processName + -%d) .setDaemon(true) .build(); } http://git-wip-us.apache.org/repos/asf/curator/blob/075f3fa8/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 cf38e21..fc462d4 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 @@ -174,7 +174,7 @@ public class CuratorFrameworkImpl implements CuratorFramework ThreadFactory threadFactory = builder.getThreadFactory(); if ( threadFactory == null ) { -threadFactory = ThreadUtils.newThreadFactory(CuratorFramework); +threadFactory = ThreadUtils.newThreadFactory(Framework); } return threadFactory; } http://git-wip-us.apache.org/repos/asf/curator/blob/075f3fa8/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java -- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java index 01204d9..3010f75 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java @@ -19,6 +19,7 @@ package org.apache.curator.framework.imps; import com.google.common.annotations.VisibleForTesting; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.curator.utils.CloseableUtils; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.CuratorTempFramework; @@ -98,7 +99,15 @@ public class CuratorTempFrameworkImpl implements CuratorTempFramework if ( cleanup == null ) { ThreadFactory threadFactory = factory.getThreadFactory(); -cleanup = (threadFactory != null) ? Executors.newScheduledThreadPool(1, threadFactory) : Executors.newScheduledThreadPool(1); + +if (threadFactory == null) +{ +threadFactory = new ThreadFactoryBuilder() +.setNameFormat(CuratorTempFrameworkImpl-%d) +.build(); +} + +cleanup = Executors.newScheduledThreadPool(1, threadFactory); Runnablecommand = new Runnable() {
[2/3] curator git commit: Merge branch 'jwilson_0102_name_threads' of https://github.com/swankjesse/curator into CURATOR-177
Merge branch 'jwilson_0102_name_threads' of https://github.com/swankjesse/curator into CURATOR-177 Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4a394d51 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4a394d51 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4a394d51 Branch: refs/heads/CURATOR-177 Commit: 4a394d51dc555183a8fd2eba970600cda998d099 Parents: e8b2c27 075f3fa Author: randgalt randg...@apache.org Authored: Mon Jan 12 14:32:57 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Jan 12 14:32:57 2015 -0500 -- .../main/java/org/apache/curator/utils/ThreadUtils.java | 2 +- .../curator/framework/imps/CuratorFrameworkImpl.java | 2 +- .../curator/framework/imps/CuratorTempFrameworkImpl.java | 11 ++- 3 files changed, 12 insertions(+), 3 deletions(-) --
[3/3] curator git commit: Added method to provide old behavior
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/870b658e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/870b658e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/870b658e Branch: refs/heads/CURATOR-177 Commit: 870b658e54969ec49fa221b45b2a2aa6d016705d Parents: 4a394d5 Author: randgalt randg...@apache.org Authored: Mon Jan 12 14:36:13 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Jan 12 14:36:13 2015 -0500 -- .../src/main/java/org/apache/curator/utils/ThreadUtils.java | 8 .../curator/framework/imps/CuratorTempFrameworkImpl.java | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/870b658e/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 8b1fbfb..ca1080d 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 @@ -54,6 +54,14 @@ public class ThreadUtils .build(); } +public static ThreadFactory newGenericThreadFactory(String processName) +{ +return new ThreadFactoryBuilder() +.setNameFormat(processName + -%d) +.setDaemon(true) +.build(); +} + public static String getProcessName(Class? clazz) { if ( clazz.isAnonymousClass() ) http://git-wip-us.apache.org/repos/asf/curator/blob/870b658e/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java -- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java index 3010f75..d5baa80 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorTempFrameworkImpl.java @@ -25,6 +25,7 @@ import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.CuratorTempFramework; import org.apache.curator.framework.api.TempGetDataBuilder; import org.apache.curator.framework.api.transaction.CuratorTransaction; +import org.apache.curator.utils.ThreadUtils; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; @@ -102,9 +103,7 @@ public class CuratorTempFrameworkImpl implements CuratorTempFramework if (threadFactory == null) { -threadFactory = new ThreadFactoryBuilder() -.setNameFormat(CuratorTempFrameworkImpl-%d) -.build(); +threadFactory = ThreadUtils.newGenericThreadFactory(CuratorTempFrameworkImpl); } cleanup = Executors.newScheduledThreadPool(1, threadFactory);
curator git commit: Closes #52 - Reaper/ChildReaper are the correct ways to do this
Repository: curator Updated Branches: refs/heads/master 2474454fb - e8b2c270b Closes #52 - Reaper/ChildReaper are the correct ways to do this Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/e8b2c270 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/e8b2c270 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/e8b2c270 Branch: refs/heads/master Commit: e8b2c270bac8af84066d1069658a8b11530a92c6 Parents: 2474454 Author: randgalt randg...@apache.org Authored: Mon Jan 12 14:28:49 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Jan 12 14:28:49 2015 -0500 -- --
[3/6] curator git commit: use standard test retry
use standard test retry Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/ab6ad24e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/ab6ad24e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/ab6ad24e Branch: refs/heads/CURATOR-175 Commit: ab6ad24ef368da6921c2aedcb866f4f41ee06d8a Parents: 9a487e2 Author: randgalt randg...@apache.org Authored: Sun Jan 4 19:38:18 2015 -0500 Committer: randgalt randg...@apache.org Committed: Sun Jan 4 19:38:18 2015 -0500 -- .../org/apache/curator/x/discovery/TestServiceDiscovery.java | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/ab6ad24e/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 a9a8896..4188a70 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 @@ -20,14 +20,13 @@ package org.apache.curator.x.discovery; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -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.retry.RetryNTimes; import org.apache.curator.retry.RetryOneTime; +import org.apache.curator.test.BaseClassForTests; import org.apache.curator.test.KillSession; import org.apache.curator.test.Timing; +import org.apache.curator.utils.CloseableUtils; import org.apache.curator.x.discovery.details.JsonInstanceSerializer; import org.apache.curator.x.discovery.details.ServiceDiscoveryImpl; import org.testng.Assert; @@ -272,7 +271,7 @@ public class TestServiceDiscovery extends BaseClassForTests ListCloseable closeables = Lists.newArrayList(); try { -CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryNTimes(0,1000)); +CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); closeables.add(client); client.start();
[2/6] curator git commit: Merge branch 'CURATOR-175' of https://github.com/gopikori/curator into CURATOR-175
Merge branch 'CURATOR-175' of https://github.com/gopikori/curator 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/9a487e23 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9a487e23 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9a487e23 Branch: refs/heads/master Commit: 9a487e23b18be80d85188b0d19647883a9007d32 Parents: 3eea676 4190147 Author: randgalt randg...@apache.org Authored: Sun Jan 4 19:34:19 2015 -0500 Committer: randgalt randg...@apache.org Committed: Sun Jan 4 19:34:19 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 8 +++-- .../x/discovery/TestServiceDiscovery.java | 35 2 files changed, 41 insertions(+), 2 deletions(-) --
[1/6] curator git commit: If zookeeper is down when discovery is started, it fails to register when the zookeeper comes up for the first time. This commit has fix for this issue
Repository: curator Updated Branches: refs/heads/CURATOR-175 [created] 7a97315dd If zookeeper is down when discovery is started, it fails to register when the zookeeper comes up for the first time. This commit has fix for this issue Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4190147d Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4190147d Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4190147d Branch: refs/heads/CURATOR-175 Commit: 4190147dbedb350ce1d42eb1ace86de0d0c9aef9 Parents: ef2ca57 Author: gopi gopi.k...@gmail.com Authored: Sun Dec 28 19:23:26 2014 +0530 Committer: gopi gopi.k...@gmail.com Committed: Sun Dec 28 19:23:26 2014 +0530 -- .../discovery/details/ServiceDiscoveryImpl.java | 8 +++-- .../x/discovery/TestServiceDiscovery.java | 35 2 files changed, 41 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/4190147d/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 ad6ce89..5f001a1 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 ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void stateChanged(CuratorFramework client, ConnectionState newState) { -if ( newState == ConnectionState.RECONNECTED ) +if ( newState == ConnectionState.RECONNECTED || newState == ConnectionState.CONNECTED ) { try { @@ -109,8 +109,12 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void start() throws Exception { +try { + reRegisterServices(); +} catch (Exception ex) { +log.error(Could not register instances, ex); +} client.getConnectionStateListenable().addListener(connectionStateListener); -reRegisterServices(); } @Override http://git-wip-us.apache.org/repos/asf/curator/blob/4190147d/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 73de7fc..a9a8896 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 @@ -24,6 +24,7 @@ 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.retry.RetryNTimes; import org.apache.curator.retry.RetryOneTime; import org.apache.curator.test.KillSession; import org.apache.curator.test.Timing; @@ -263,4 +264,38 @@ public class TestServiceDiscovery extends BaseClassForTests } } } + +@Test +public void testNoServerOnStart() throws Exception +{ +server.stop(); +ListCloseable closeables = Lists.newArrayList(); +try +{ +CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryNTimes(0,1000)); +closeables.add(client); +client.start(); + +ServiceInstanceString instance = ServiceInstance.Stringbuilder().payload(thing).name(test).port(10064).build(); +ServiceDiscoveryStringdiscovery = 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)); + +ListServiceInstanceString list = Lists.newArrayList(); +list.add(instance); +Assert.assertEquals(discovery.queryForInstances(test), list); +} +finally +{ +Collections.reverse(closeables); +for ( Closeable c :
[6/6] curator git commit: remove duplicate
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/master Commit: 7a97315dd264a61cb3ea8c02b484cf744e39298c Parents: f2f03ce Author: randgalt randg...@apache.org Authored: Mon Jan 12 15:30:43 2015 -0500 Committer: randgalt randg...@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(); -ListCloseable closeables = Lists.newArrayList(); -try -{ -CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); -closeables.add(client); -client.start(); - -ServiceInstanceString instance = ServiceInstance.Stringbuilder().payload(thing).name(test).port(10064).build(); -ServiceDiscoveryStringdiscovery = 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)); - -ListServiceInstanceString list = Lists.newArrayList(); -list.add(instance); -Assert.assertEquals(discovery.queryForInstances(test), list); -} -finally -{ -Collections.reverse(closeables); -for ( Closeable c : closeables ) -{ -CloseableUtils.closeQuietly(c); -} -} -} - }
[1/6] curator git commit: If zookeeper is down when discovery is started, it fails to register when the zookeeper comes up for the first time. This commit has fix for this issue
Repository: curator Updated Branches: refs/heads/master 40b2cd802 - 7a97315dd If zookeeper is down when discovery is started, it fails to register when the zookeeper comes up for the first time. This commit has fix for this issue Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4190147d Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4190147d Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4190147d Branch: refs/heads/master Commit: 4190147dbedb350ce1d42eb1ace86de0d0c9aef9 Parents: ef2ca57 Author: gopi gopi.k...@gmail.com Authored: Sun Dec 28 19:23:26 2014 +0530 Committer: gopi gopi.k...@gmail.com Committed: Sun Dec 28 19:23:26 2014 +0530 -- .../discovery/details/ServiceDiscoveryImpl.java | 8 +++-- .../x/discovery/TestServiceDiscovery.java | 35 2 files changed, 41 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/4190147d/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 ad6ce89..5f001a1 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 ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void stateChanged(CuratorFramework client, ConnectionState newState) { -if ( newState == ConnectionState.RECONNECTED ) +if ( newState == ConnectionState.RECONNECTED || newState == ConnectionState.CONNECTED ) { try { @@ -109,8 +109,12 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void start() throws Exception { +try { + reRegisterServices(); +} catch (Exception ex) { +log.error(Could not register instances, ex); +} client.getConnectionStateListenable().addListener(connectionStateListener); -reRegisterServices(); } @Override http://git-wip-us.apache.org/repos/asf/curator/blob/4190147d/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 73de7fc..a9a8896 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 @@ -24,6 +24,7 @@ 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.retry.RetryNTimes; import org.apache.curator.retry.RetryOneTime; import org.apache.curator.test.KillSession; import org.apache.curator.test.Timing; @@ -263,4 +264,38 @@ public class TestServiceDiscovery extends BaseClassForTests } } } + +@Test +public void testNoServerOnStart() throws Exception +{ +server.stop(); +ListCloseable closeables = Lists.newArrayList(); +try +{ +CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryNTimes(0,1000)); +closeables.add(client); +client.start(); + +ServiceInstanceString instance = ServiceInstance.Stringbuilder().payload(thing).name(test).port(10064).build(); +ServiceDiscoveryStringdiscovery = 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)); + +ListServiceInstanceString list = Lists.newArrayList(); +list.add(instance); +Assert.assertEquals(discovery.queryForInstances(test), list); +} +finally +{ +Collections.reverse(closeables); +for ( Closeable c : closeables ) +
[5/6] curator git commit: Merge branch 'CURATOR-175.2' into CURATOR-175
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/master Commit: f2f03ce82179d74177f2595e0221ee4cbbcd86fa Parents: ab6ad24 94fce2c Author: randgalt randg...@apache.org Authored: Mon Jan 12 15:30:07 2015 -0500 Committer: randgalt randg...@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 --
[4/6] curator git commit: Look for connection errors and merely log when starting. Also, reset instances on initial connection
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/master Commit: 94fce2ca94f827cd3d3c793dbf044bff39ef52a7 Parents: 40b2cd8 Author: randgalt randg...@apache.org Authored: Mon Jan 12 15:28:56 2015 -0500 Committer: randgalt randg...@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 ServiceDiscoveryImplT implements ServiceDiscoveryT @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 ServiceDiscoveryImplT implements ServiceDiscoveryT @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(); +ListCloseable closeables = Lists.newArrayList(); +try +{ +CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); +closeables.add(client); +client.start(); + +ServiceInstanceString instance = ServiceInstance.Stringbuilder().payload(thing).name(test).port(10064).build(); +ServiceDiscoveryStringdiscovery = 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)); + +ListServiceInstanceString list = Lists.newArrayList(); +list.add(instance); +Assert.assertEquals(discovery.queryForInstances(test), list); +} +finally +{ +Collections.reverse(closeables); +for ( Closeable c : closeables ) +{ +CloseableUtils.closeQuietly(c); +} +} +} }
[3/6] curator git commit: use standard test retry
use standard test retry Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/ab6ad24e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/ab6ad24e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/ab6ad24e Branch: refs/heads/master Commit: ab6ad24ef368da6921c2aedcb866f4f41ee06d8a Parents: 9a487e2 Author: randgalt randg...@apache.org Authored: Sun Jan 4 19:38:18 2015 -0500 Committer: randgalt randg...@apache.org Committed: Sun Jan 4 19:38:18 2015 -0500 -- .../org/apache/curator/x/discovery/TestServiceDiscovery.java | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/ab6ad24e/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 a9a8896..4188a70 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 @@ -20,14 +20,13 @@ package org.apache.curator.x.discovery; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -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.retry.RetryNTimes; import org.apache.curator.retry.RetryOneTime; +import org.apache.curator.test.BaseClassForTests; import org.apache.curator.test.KillSession; import org.apache.curator.test.Timing; +import org.apache.curator.utils.CloseableUtils; import org.apache.curator.x.discovery.details.JsonInstanceSerializer; import org.apache.curator.x.discovery.details.ServiceDiscoveryImpl; import org.testng.Assert; @@ -272,7 +271,7 @@ public class TestServiceDiscovery extends BaseClassForTests ListCloseable closeables = Lists.newArrayList(); try { -CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryNTimes(0,1000)); +CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); closeables.add(client); client.start();
[1/4] curator git commit: CURATOR-166: Allow ZKPaths to build paths with an arbitrary number of children.
Repository: curator Updated Branches: refs/heads/CURATOR-166 [created] 84699d336 CURATOR-166: Allow ZKPaths to build paths with an arbitrary number of children. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/01a23e9c Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/01a23e9c Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/01a23e9c Branch: refs/heads/CURATOR-166 Commit: 01a23e9c043277ab80d9f78b8c58b7aab06c902b Parents: ef2ca57 Author: Ricardo Ferreira ricardo.ferre...@feedzai.com Authored: Fri Nov 14 23:48:31 2014 + Committer: Ricardo Ferreira ricardo.ferre...@feedzai.com Committed: Fri Nov 14 23:48:31 2014 + -- .../java/org/apache/curator/utils/ZKPaths.java | 71 +--- .../org/apache/curator/utils/TestZKPaths.java | 10 +++ 2 files changed, 57 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/01a23e9c/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java -- diff --git a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java index 352bfd6..300913b 100644 --- a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java +++ b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java @@ -32,6 +32,12 @@ import java.util.List; public class ZKPaths { /** + * Zookeeper's path separator character. + */ +public static final String PATH_SEPARATOR = /; + + +/** * Apply the namespace to the given path * * @param namespace namespace (can be null) @@ -59,7 +65,7 @@ public class ZKPaths public static String getNodeFromPath(String path) { PathUtils.validatePath(path); -int i = path.lastIndexOf('/'); +int i = path.lastIndexOf(PATH_SEPARATOR); if ( i 0 ) { return path; @@ -102,21 +108,21 @@ public class ZKPaths public static PathAndNode getPathAndNode(String path) { PathUtils.validatePath(path); -int i = path.lastIndexOf('/'); +int i = path.lastIndexOf(PATH_SEPARATOR); if ( i 0 ) { return new PathAndNode(path, ); } if ( (i + 1) = path.length() ) { -return new PathAndNode(/, ); +return new PathAndNode(PATH_SEPARATOR, ); } String node = path.substring(i + 1); -String parentPath = (i 0) ? path.substring(0, i) : /; +String parentPath = (i 0) ? path.substring(0, i) : PATH_SEPARATOR; return new PathAndNode(parentPath, node); } -private static final Splitter PATH_SPLITTER = Splitter.on('/').omitEmptyStrings(); +private static final Splitter PATH_SPLITTER = Splitter.on(PATH_SEPARATOR).omitEmptyStrings(); /** * Given a full path, return the the individual parts, without slashes. @@ -178,7 +184,7 @@ public class ZKPaths int pos = 1; // skip first slash, root is guaranteed to exist do { -pos = path.indexOf('/', pos + 1); +pos = path.indexOf(PATH_SEPARATOR, pos + 1); if ( pos == -1 ) { @@ -276,26 +282,26 @@ public class ZKPaths Collections.sort(sortedList); return sortedList; } - + /** - * Given a parent path and a child node, create a combined full path + * Given a parent path and a list of children nodes, create a combined full path * * @param parent the parent - * @param child the child + * @param children the children * @return full path */ -public static String makePath(String parent, String child) +public static String makePath(String parent, String... children) { StringBuilder path = new StringBuilder(); // Add parent piece, with no trailing slash. if ( (parent != null) (parent.length() 0) ) { -if ( !parent.startsWith(/) ) +if ( !parent.startsWith(PATH_SEPARATOR) ) { -path.append('/'); +path.append(PATH_SEPARATOR); } -if ( parent.endsWith(/) ) +if ( parent.endsWith(PATH_SEPARATOR) ) { path.append(parent.substring(0, parent.length() - 1)); } @@ -305,26 +311,43 @@ public class ZKPaths } } -if ( (child == null) || (child.length() == 0) || (child.equals(/)) ) +if (children == null || children.length == 0) { // Special case, empty parent and child if ( path.length() == 0 ) { -return /; +
[3/4] curator git commit: Merge branch 'CURATOR-166' of https://github.com/rfer/curator into CURATOR-166
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-166 Commit: 687672a390033203661aa368fa32a4d1673761e8 Parents: 7a97315 b387cf0 Author: randgalt randg...@apache.org Authored: Mon Jan 12 15:41:13 2015 -0500 Committer: randgalt randg...@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(-) --
[4/4] curator git commit: eliminated warning
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/master Commit: 84699d336fa96f78cbeca25b159091acd95384df Parents: 687672a Author: randgalt randg...@apache.org Authored: Mon Jan 12 15:49:19 2015 -0500 Committer: randgalt randg...@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() {
[2/4] curator git commit: CURATOR-166: Reverted to using two overloads in order to keep binary compatibiity and avoid uneeded array allocation.
CURATOR-166: Reverted to using two overloads in order to keep binary compatibiity and avoid uneeded array allocation. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b387cf09 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b387cf09 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b387cf09 Branch: refs/heads/master Commit: b387cf0963d184c9b2aad88a4947e1bb5ed1275d Parents: 01a23e9 Author: Ricardo Ferreira ricardo.ferre...@feedzai.com Authored: Mon Nov 17 23:02:51 2014 + Committer: Ricardo Ferreira ricardo.ferre...@feedzai.com Committed: Mon Nov 17 23:02:51 2014 + -- .../java/org/apache/curator/utils/ZKPaths.java | 95 +--- 1 file changed, 61 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/b387cf09/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java -- diff --git a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java index 300913b..f485c62 100644 --- a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java +++ b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java @@ -282,18 +282,61 @@ public class ZKPaths Collections.sort(sortedList); return sortedList; } - + /** - * Given a parent path and a list of children nodes, create a combined full path + * Given a parent path and a child node, create a combined full path * * @param parent the parent - * @param children the children + * @param child the child * @return full path */ -public static String makePath(String parent, String... children) +public static String makePath(String parent, String child) { StringBuilder path = new StringBuilder(); +joinPath(path, parent, child); + +return path.toString(); +} + +/** + * Given a parent path and a list of children nodes, create a combined full path + * + * @param parent the parent + * @param firstChild the first children in the path + * @param restChildren the rest of the children in the path + * @return full path + */ +public static String makePath(String parent, String firstChild, String... restChildren) +{ +StringBuilder path = new StringBuilder(); + +joinPath(path, parent, firstChild); + +if ( restChildren == null ) +{ +return path.toString(); +} +else +{ +for ( String child : restChildren ) +{ +joinPath(path, , child); +} + +return path.toString(); +} +} + +/** + * Given a parent and a child node, join them in the given {@link StringBuilder path} + * + * @param path the {@link StringBuilder} used to make the path + * @param parent the parent + * @param child the child + */ +private static void joinPath(StringBuilder path, String parent, String child) +{ // Add parent piece, with no trailing slash. if ( (parent != null) (parent.length() 0) ) { @@ -311,47 +354,31 @@ public class ZKPaths } } -if (children == null || children.length == 0) +if ( (child == null) || (child.length() == 0) || (child.equals(PATH_SEPARATOR)) ) { // Special case, empty parent and child if ( path.length() == 0 ) { -return PATH_SEPARATOR; +path.append(PATH_SEPARATOR); } -return path.toString(); +return; } -for (String child : children) -{ -if ( (child == null) || (child.length() == 0) || (child.equals(PATH_SEPARATOR)) ) -{ -// Special case, empty parent and child -if ( path.length() == 0 ) -{ -path.append(PATH_SEPARATOR); -} +// Now add the separator between parent and child. +path.append(PATH_SEPARATOR); -continue; -} - -// Now add the separator between parent and child. -path.append(PATH_SEPARATOR); - -if ( child.startsWith(PATH_SEPARATOR) ) -{ -child = child.substring(1); -} - -if ( child.endsWith(PATH_SEPARATOR) ) -{ -child = child.substring(0, child.length() - 1); -} +if ( child.startsWith(PATH_SEPARATOR) ) +{ +child = child.substring(1); +} -// Finally, add the child. -
[2/4] curator git commit: CURATOR-166: Reverted to using two overloads in order to keep binary compatibiity and avoid uneeded array allocation.
CURATOR-166: Reverted to using two overloads in order to keep binary compatibiity and avoid uneeded array allocation. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b387cf09 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b387cf09 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b387cf09 Branch: refs/heads/CURATOR-166 Commit: b387cf0963d184c9b2aad88a4947e1bb5ed1275d Parents: 01a23e9 Author: Ricardo Ferreira ricardo.ferre...@feedzai.com Authored: Mon Nov 17 23:02:51 2014 + Committer: Ricardo Ferreira ricardo.ferre...@feedzai.com Committed: Mon Nov 17 23:02:51 2014 + -- .../java/org/apache/curator/utils/ZKPaths.java | 95 +--- 1 file changed, 61 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/b387cf09/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java -- diff --git a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java index 300913b..f485c62 100644 --- a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java +++ b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java @@ -282,18 +282,61 @@ public class ZKPaths Collections.sort(sortedList); return sortedList; } - + /** - * Given a parent path and a list of children nodes, create a combined full path + * Given a parent path and a child node, create a combined full path * * @param parent the parent - * @param children the children + * @param child the child * @return full path */ -public static String makePath(String parent, String... children) +public static String makePath(String parent, String child) { StringBuilder path = new StringBuilder(); +joinPath(path, parent, child); + +return path.toString(); +} + +/** + * Given a parent path and a list of children nodes, create a combined full path + * + * @param parent the parent + * @param firstChild the first children in the path + * @param restChildren the rest of the children in the path + * @return full path + */ +public static String makePath(String parent, String firstChild, String... restChildren) +{ +StringBuilder path = new StringBuilder(); + +joinPath(path, parent, firstChild); + +if ( restChildren == null ) +{ +return path.toString(); +} +else +{ +for ( String child : restChildren ) +{ +joinPath(path, , child); +} + +return path.toString(); +} +} + +/** + * Given a parent and a child node, join them in the given {@link StringBuilder path} + * + * @param path the {@link StringBuilder} used to make the path + * @param parent the parent + * @param child the child + */ +private static void joinPath(StringBuilder path, String parent, String child) +{ // Add parent piece, with no trailing slash. if ( (parent != null) (parent.length() 0) ) { @@ -311,47 +354,31 @@ public class ZKPaths } } -if (children == null || children.length == 0) +if ( (child == null) || (child.length() == 0) || (child.equals(PATH_SEPARATOR)) ) { // Special case, empty parent and child if ( path.length() == 0 ) { -return PATH_SEPARATOR; +path.append(PATH_SEPARATOR); } -return path.toString(); +return; } -for (String child : children) -{ -if ( (child == null) || (child.length() == 0) || (child.equals(PATH_SEPARATOR)) ) -{ -// Special case, empty parent and child -if ( path.length() == 0 ) -{ -path.append(PATH_SEPARATOR); -} +// Now add the separator between parent and child. +path.append(PATH_SEPARATOR); -continue; -} - -// Now add the separator between parent and child. -path.append(PATH_SEPARATOR); - -if ( child.startsWith(PATH_SEPARATOR) ) -{ -child = child.substring(1); -} - -if ( child.endsWith(PATH_SEPARATOR) ) -{ -child = child.substring(0, child.length() - 1); -} +if ( child.startsWith(PATH_SEPARATOR) ) +{ +child = child.substring(1); +} -// Finally, add the
[3/4] curator git commit: Merge branch 'CURATOR-166' of https://github.com/rfer/curator into CURATOR-166
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/master Commit: 687672a390033203661aa368fa32a4d1673761e8 Parents: 7a97315 b387cf0 Author: randgalt randg...@apache.org Authored: Mon Jan 12 15:41:13 2015 -0500 Committer: randgalt randg...@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(-) --
[1/3] curator git commit: Patch v1: Add authorization(ListAuthInfo)
Repository: curator Updated Branches: refs/heads/master 84699d336 - 7fc3e6507 Patch v1: Add authorization(ListAuthInfo) Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/71dc640b Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/71dc640b Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/71dc640b Branch: refs/heads/master Commit: 71dc640b663057a6acaae1f9af93aea48fee3de9 Parents: de1d38c Author: Karthik Kambatla ka...@cloudera.com Authored: Mon Dec 29 14:16:55 2014 -0800 Committer: Karthik Kambatla ka...@cloudera.com Committed: Mon Dec 29 14:16:55 2014 -0800 -- .../org/apache/curator/framework/AuthInfo.java | 51 .../framework/CuratorFrameworkFactory.java | 23 + .../framework/imps/CuratorFrameworkImpl.java| 40 ++- .../curator/framework/imps/TestFramework.java | 45 + 4 files changed, 133 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/71dc640b/curator-framework/src/main/java/org/apache/curator/framework/AuthInfo.java -- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/AuthInfo.java b/curator-framework/src/main/java/org/apache/curator/framework/AuthInfo.java new file mode 100644 index 000..2f879c5 --- /dev/null +++ b/curator-framework/src/main/java/org/apache/curator/framework/AuthInfo.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.curator.framework; + +import java.util.Arrays; + +public class AuthInfo +{ +final Stringscheme; +final byte[]auth; + +public AuthInfo(String scheme, byte[] auth) +{ +this.scheme = scheme; +this.auth = auth; +} + +public String getScheme() { +return scheme; +} + +public byte[] getAuth() { +return auth; +} + +@Override +public String toString() +{ +return AuthInfo{ + +scheme=' + scheme + '\'' + +, auth= + Arrays.toString(auth) + +'}'; +} +} http://git-wip-us.apache.org/repos/asf/curator/blob/71dc640b/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 2d21fb7..4d695e4 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 @@ -34,7 +34,9 @@ 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; import java.util.concurrent.TimeUnit; @@ -106,6 +108,7 @@ public class CuratorFrameworkFactory private String namespace; private String authScheme = null; private byte[] authValue = null; +private ListAuthInfo authInfos = null; private byte[] defaultData = LOCAL_ADDRESS; private CompressionProvider compressionProvider = DEFAULT_COMPRESSION_PROVIDER; private ZookeeperFactoryzookeeperFactory = DEFAULT_ZOOKEEPER_FACTORY; @@ -165,6 +168,21 @@ 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. + * + * Subsequent calls to this method overwrite the prior calls. + * + * @param authInfos list of {@link
[3/3] curator git commit: Use Guava
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/master Commit: 7fc3e6507d5bcbb16c696906bed529c23df88e34 Parents: 58ecd64 Author: randgalt randg...@apache.org Authored: Mon Jan 12 16:03:35 2015 -0500 Committer: randgalt randg...@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 intDEFAULT_SESSION_TIMEOUT_MS = Integer.getInteger(curator-default-session-timeout, 60 * 1000); -private static final intDEFAULT_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 DefaultZookeeperFactoryDEFAULT_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 intDEFAULT_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
curator git commit: If a service is updated, update the services map. Closes #43
Repository: curator Updated Branches: refs/heads/master 7fc3e6507 - dad2888c7 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/master Commit: dad2888c7f8ffc2203f21f54cc27c93e7576c5e1 Parents: 7fc3e65 Author: randgalt randg...@apache.org Authored: Mon Jan 12 16:11:55 2015 -0500 Committer: randgalt randg...@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 ServiceDiscoveryImplT implements ServiceDiscoveryT byte[] bytes = serializer.serialize(service); String path = pathForInstance(service.getName(), service.getId()); client.setData().forPath(path, bytes); +services.put(service.getId(), service); } @VisibleForTesting
[3/3] curator git commit: Use Guava
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-111 Commit: 7fc3e6507d5bcbb16c696906bed529c23df88e34 Parents: 58ecd64 Author: randgalt randg...@apache.org Authored: Mon Jan 12 16:03:35 2015 -0500 Committer: randgalt randg...@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 intDEFAULT_SESSION_TIMEOUT_MS = Integer.getInteger(curator-default-session-timeout, 60 * 1000); -private static final intDEFAULT_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 DefaultZookeeperFactoryDEFAULT_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 intDEFAULT_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
[1/3] curator git commit: Patch v1: Add authorization(ListAuthInfo)
Repository: curator Updated Branches: refs/heads/CURATOR-111 [created] 7fc3e6507 Patch v1: Add authorization(ListAuthInfo) Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/71dc640b Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/71dc640b Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/71dc640b Branch: refs/heads/CURATOR-111 Commit: 71dc640b663057a6acaae1f9af93aea48fee3de9 Parents: de1d38c Author: Karthik Kambatla ka...@cloudera.com Authored: Mon Dec 29 14:16:55 2014 -0800 Committer: Karthik Kambatla ka...@cloudera.com Committed: Mon Dec 29 14:16:55 2014 -0800 -- .../org/apache/curator/framework/AuthInfo.java | 51 .../framework/CuratorFrameworkFactory.java | 23 + .../framework/imps/CuratorFrameworkImpl.java| 40 ++- .../curator/framework/imps/TestFramework.java | 45 + 4 files changed, 133 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/71dc640b/curator-framework/src/main/java/org/apache/curator/framework/AuthInfo.java -- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/AuthInfo.java b/curator-framework/src/main/java/org/apache/curator/framework/AuthInfo.java new file mode 100644 index 000..2f879c5 --- /dev/null +++ b/curator-framework/src/main/java/org/apache/curator/framework/AuthInfo.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.curator.framework; + +import java.util.Arrays; + +public class AuthInfo +{ +final Stringscheme; +final byte[]auth; + +public AuthInfo(String scheme, byte[] auth) +{ +this.scheme = scheme; +this.auth = auth; +} + +public String getScheme() { +return scheme; +} + +public byte[] getAuth() { +return auth; +} + +@Override +public String toString() +{ +return AuthInfo{ + +scheme=' + scheme + '\'' + +, auth= + Arrays.toString(auth) + +'}'; +} +} http://git-wip-us.apache.org/repos/asf/curator/blob/71dc640b/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 2d21fb7..4d695e4 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 @@ -34,7 +34,9 @@ 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; import java.util.concurrent.TimeUnit; @@ -106,6 +108,7 @@ public class CuratorFrameworkFactory private String namespace; private String authScheme = null; private byte[] authValue = null; +private ListAuthInfo authInfos = null; private byte[] defaultData = LOCAL_ADDRESS; private CompressionProvider compressionProvider = DEFAULT_COMPRESSION_PROVIDER; private ZookeeperFactoryzookeeperFactory = DEFAULT_ZOOKEEPER_FACTORY; @@ -165,6 +168,21 @@ 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. + * + * Subsequent calls to this method overwrite the prior calls. + * + * @param authInfos list of
[2/3] curator git commit: Merge branch 'CURATOR-111' of https://github.com/kambatla/curator into CURATOR-111
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-111 Commit: 58ecd64f0b0b05590f2bcd350d17c173a5c791ab Parents: 84699d3 71dc640 Author: randgalt randg...@apache.org Authored: Mon Jan 12 15:55:20 2015 -0500 Committer: randgalt randg...@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 Loggerlog = LoggerFactory.getLogger(getClass()); -private final CuratorZookeeperClient client; -private final ListenerContainerCuratorListener listeners; -private final ListenerContainerUnhandledErrorListener unhandledErrorListeners; -private final ThreadFactory threadFactory; -private final BlockingQueueOperationAndData? backgroundOperations; -private final NamespaceImpl namespace; -private final ConnectionStateManager connectionStateManager; -private final ListAuthInfo 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 ListenerContainerCuratorListener listeners; +private final ListenerContainerUnhandledErrorListener unhandledErrorListeners; +private final ThreadFactory threadFactory; +private final int maxCloseWaitMs; +private final BlockingQueueOperationAndData? backgroundOperations; +private final NamespaceImpl namespace; +private final ConnectionStateManager connectionStateManager; - private final AtomicReferenceAuthInfo authInfo = new AtomicReferenceAuthInfo(); ++private final ListAuthInfo authInfos; +private final byte[] defaultData; +private final FailedDeleteManager failedDeleteManager; +private final CompressionProvider compressionProvider; +private final ACLProvider aclProvider; +private final
[2/3] curator git commit: Merge branch 'CURATOR-111' of https://github.com/kambatla/curator into CURATOR-111
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/master Commit: 58ecd64f0b0b05590f2bcd350d17c173a5c791ab Parents: 84699d3 71dc640 Author: randgalt randg...@apache.org Authored: Mon Jan 12 15:55:20 2015 -0500 Committer: randgalt randg...@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 Loggerlog = LoggerFactory.getLogger(getClass()); -private final CuratorZookeeperClient client; -private final ListenerContainerCuratorListener listeners; -private final ListenerContainerUnhandledErrorListener unhandledErrorListeners; -private final ThreadFactory threadFactory; -private final BlockingQueueOperationAndData? backgroundOperations; -private final NamespaceImpl namespace; -private final ConnectionStateManager connectionStateManager; -private final ListAuthInfo 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 ListenerContainerCuratorListener listeners; +private final ListenerContainerUnhandledErrorListener unhandledErrorListeners; +private final ThreadFactory threadFactory; +private final int maxCloseWaitMs; +private final BlockingQueueOperationAndData? backgroundOperations; +private final NamespaceImpl namespace; +private final ConnectionStateManager connectionStateManager; - private final AtomicReferenceAuthInfo authInfo = new AtomicReferenceAuthInfo(); ++private final ListAuthInfo authInfos; +private final byte[] defaultData; +private final FailedDeleteManager failedDeleteManager; +private final CompressionProvider compressionProvider; +private final ACLProvider aclProvider; +private final
[08/10] curator git commit: Retain previous methods for backward compatibility
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/master Commit: 9ccf2a3f7d5fb3808ede3c2a99af8d358b40815e Parents: 5832891 Author: randgalt randg...@apache.org Authored: Tue Jan 13 07:45:04 2015 -0500 Committer: randgalt randg...@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 ListAuthInfo getAuthInfos() { return authInfos;
[03/10] curator git commit: [maven-release-plugin] prepare for next development iteration
[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/master Commit: 3dc0c0cac7334cbbb0a7fb3694c12dd408fa2eed Parents: c249053 Author: randgalt randg...@apache.org Authored: Mon Jan 12 21:35:20 2015 -0500 Committer: randgalt randg...@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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version /parent artifactIdcurator-client/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version /parent artifactIdcurator-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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version /parent artifactIdcurator-framework/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version /parent artifactIdcurator-recipes/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version /parent artifactIdcurator-test/artifactId -version2.7.1/version +version2.7.2-SNAPSHOT/version nameCurator Testing/name descriptionUnit 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1/version
[10/10] curator git commit: Merge branch 'CURATOR-111'
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/master Commit: 5ded39fa529f4359032fced16a7a537f538b2598 Parents: 674f394 9d61c12 Author: randgalt randg...@apache.org Authored: Tue Jan 13 07:49:21 2015 -0500 Committer: randgalt randg...@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 --
[07/10] 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 c
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/master Commit: 58328915a6e005bc4171bb866cb2eba4762c3718 Parents: 7fc3e65 Author: Cameron McKenzie came...@unico.com.au Authored: Tue Jan 13 16:42:59 2015 +1100 Committer: Cameron McKenzie came...@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 ListAuthInfo 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 ListAuthInfo 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 ListAuthInfo buildAuths(CuratorFrameworkFactory.Builder builder) { ImmutableList.BuilderAuthInfo builder1 = ImmutableList.builder(); -if ( builder.getAuthScheme() != null ) -{ -
[09/10] curator git commit: minor formatting
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/master Commit: 9d61c122890a6a147a9a63ec7b503a14b1e61b90 Parents: 9ccf2a3 Author: randgalt randg...@apache.org Authored: Tue Jan 13 07:47:07 2015 -0500 Committer: randgalt randg...@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); +} } }
[02/10] curator git commit: [maven-release-plugin] prepare release apache-curator-2.7.1
[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/master Commit: c24905328b4b6d7b6fe6536ed017a584a9e6e2e0 Parents: b8715ca Author: randgalt randg...@apache.org Authored: Mon Jan 12 21:35:19 2015 -0500 Committer: randgalt randg...@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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version /parent artifactIdcurator-client/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version /parent artifactIdcurator-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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version /parent artifactIdcurator-framework/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version /parent artifactIdcurator-recipes/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version /parent artifactIdcurator-test/artifactId -version2.7.1-SNAPSHOT/version +version2.7.1/version nameCurator Testing/name descriptionUnit 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.1-SNAPSHOT/version
[01/10] curator git commit: fixed license url
Repository: curator Updated Branches: refs/heads/master b3fb2cfee - 5ded39fa5 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/master Commit: b8715ca8cd7e612daeffa3be69442839d051dee6 Parents: b3fb2cf Author: randgalt randg...@apache.org Authored: Mon Jan 12 21:34:10 2015 -0500 Committer: randgalt randg...@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 nameThe Apache Software License, Version 2.0/name -urlfile://${basedir}/LICENSE/url +urlhttp://www.apache.org/licenses/LICENSE-2.0.txt/url distributionrepo/distribution /license /licenses
[04/10] curator git commit: back to 2.7.1 cause I f'd up the release
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/master Commit: 169b610adcdaff3ac14d58c89ff5dc6c5f5ef108 Parents: 3dc0c0c Author: randgalt randg...@apache.org Authored: Mon Jan 12 21:53:42 2015 -0500 Committer: randgalt randg...@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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-client/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-framework/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-recipes/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-test/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version nameCurator Testing/name descriptionUnit 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 groupIdorg.apache.curator/groupId artifactIdapache
Git Push Summary
Repository: curator Updated Tags: refs/tags/apache-curator-2.7.1 [created] ba9fb60c5
curator git commit: Retain previous methods for backward compatibility
Repository: curator Updated Branches: refs/heads/CURATOR-111 58328915a - 9ccf2a3f7 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-111 Commit: 9ccf2a3f7d5fb3808ede3c2a99af8d358b40815e Parents: 5832891 Author: randgalt randg...@apache.org Authored: Tue Jan 13 07:45:04 2015 -0500 Committer: randgalt randg...@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 ListAuthInfo getAuthInfos() { return authInfos;
Git Push Summary
Repository: curator Updated Tags: refs/tags/apache-curator-2.7.1 [deleted] 0bc196eef
curator git commit: Final fix for backward compat ACL APIs and tests
Repository: curator Updated Branches: refs/heads/master 34bd3e8f3 - 570352d54 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/master Commit: 570352d547ad32270109692abccc2ea30ea74294 Parents: 34bd3e8 Author: randgalt randg...@apache.org Authored: Tue Jan 13 08:28:14 2015 -0500 Committer: randgalt randg...@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 ListAuthInfo authInfos = new ArrayListAuthInfo(); @@ -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
curator git commit: back to 2.7.1-SNAPSHOT due to bad build
Repository: curator Updated Branches: refs/heads/master 5ded39fa5 - 34bd3e8f3 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/master Commit: 34bd3e8f39a5d07cd5a024c6375491080e36ff05 Parents: 5ded39f Author: randgalt randg...@apache.org Authored: Tue Jan 13 07:50:36 2015 -0500 Committer: randgalt randg...@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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-client/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-framework/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-recipes/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version packagingbundle/packaging nameCurator 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 groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version /parent artifactIdcurator-test/artifactId -version2.7.2-SNAPSHOT/version +version2.7.1-SNAPSHOT/version nameCurator Testing/name descriptionUnit 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
svn commit: r1651399 - in /curator/site/trunk: ./ apidocs/ apidocs/cache/ apidocs/cache/class-use/ apidocs/discovery/ apidocs/discovery/class-use/ apidocs/framework/ apidocs/framework/class-use/ apido
Author: randgalt Date: Tue Jan 13 16:27:07 2015 New Revision: 1651399 URL: http://svn.apache.org/r1651399 Log: 2.7.1 [This commit notification would consist of 55 parts, which exceeds the limit of 50 ones, so it was shortened to the summary.]
curator git commit: Use NodeCache instead of manually watching. It's safer and more Curator-like
Repository: curator Updated Branches: refs/heads/CURATOR-176 37dc44785 - 11dad7983 Use NodeCache instead of manually watching. It's safer and more Curator-like Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/11dad798 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/11dad798 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/11dad798 Branch: refs/heads/CURATOR-176 Commit: 11dad79838b4dc00d6a5ebc59c55fe124f55d22c Parents: 37dc447 Author: randgalt randg...@apache.org Authored: Mon Jan 12 12:29:44 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Jan 12 12:29:44 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 92 ++-- 1 file changed, 48 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/11dad798/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 ca8eabe..3a92e7a 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 @@ -25,10 +25,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import org.apache.curator.framework.CuratorFramework; -import org.apache.curator.framework.api.BackgroundCallback; -import org.apache.curator.framework.api.CuratorEvent; -import org.apache.curator.framework.api.CuratorEventType; -import org.apache.curator.framework.api.CuratorWatcher; +import org.apache.curator.framework.recipes.cache.NodeCache; +import org.apache.curator.framework.recipes.cache.NodeCacheListener; import org.apache.curator.framework.state.ConnectionState; import org.apache.curator.framework.state.ConnectionStateListener; import org.apache.curator.utils.CloseableUtils; @@ -44,7 +42,6 @@ import org.apache.curator.x.discovery.ServiceType; import org.apache.curator.x.discovery.strategies.RoundRobinStrategy; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; -import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,9 +61,9 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT private final String basePath; private final InstanceSerializerT serializer; private final MapString, ServiceInstanceT services = Maps.newConcurrentMap(); +private final MapString, NodeCache watchedServices; private final CollectionServiceCacheT caches = Sets.newSetFromMap(Maps.ServiceCacheT, BooleannewConcurrentMap()); private final CollectionServiceProviderT providers = Sets.newSetFromMap(Maps.ServiceProviderT, BooleannewConcurrentMap()); -private final boolean watchInstances; private final ConnectionStateListener connectionStateListener = new ConnectionStateListener() { @Override @@ -96,13 +93,13 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT */ public ServiceDiscoveryImpl(CuratorFramework client, String basePath, InstanceSerializerT serializer, ServiceInstanceT thisInstance, boolean watchInstances) { -this.watchInstances = watchInstances; this.client = Preconditions.checkNotNull(client, client cannot be null); this.basePath = Preconditions.checkNotNull(basePath, basePath cannot be null); this.serializer = Preconditions.checkNotNull(serializer, serializer cannot be null); +watchedServices = watchInstances ? Maps.String, NodeCachenewConcurrentMap() : null; if ( thisInstance != null ) { -services.put(thisInstance.getId(), thisInstance); +setService(thisInstance); } } @@ -129,6 +126,13 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT { CloseableUtils.closeQuietly(provider); } +if ( watchedServices != null ) +{ +for ( NodeCache nodeCache : watchedServices.values() ) +{ +CloseableUtils.closeQuietly(nodeCache); +} +} IteratorServiceInstanceT it = services.values().iterator(); while ( it.hasNext() ) @@ -171,7 +175,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void registerService(ServiceInstanceT service) throws Exception
[2/3] curator git commit: Merge branch 'CURATOR-176'
Merge branch 'CURATOR-176' Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/8a84f596 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/8a84f596 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/8a84f596 Branch: refs/heads/master Commit: 8a84f5968a3297f09d31c3a8eb8beca8477b50a5 Parents: f17b46f 11dad79 Author: randgalt randg...@apache.org Authored: Mon Jan 12 12:31:00 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Jan 12 12:31:00 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 92 ++-- 1 file changed, 48 insertions(+), 44 deletions(-) --
[1/3] curator git commit: Use NodeCache instead of manually watching. It's safer and more Curator-like
Repository: curator Updated Branches: refs/heads/master a0a676e3e - 2474454fb Use NodeCache instead of manually watching. It's safer and more Curator-like Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/11dad798 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/11dad798 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/11dad798 Branch: refs/heads/master Commit: 11dad79838b4dc00d6a5ebc59c55fe124f55d22c Parents: 37dc447 Author: randgalt randg...@apache.org Authored: Mon Jan 12 12:29:44 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Jan 12 12:29:44 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 92 ++-- 1 file changed, 48 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/11dad798/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 ca8eabe..3a92e7a 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 @@ -25,10 +25,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import org.apache.curator.framework.CuratorFramework; -import org.apache.curator.framework.api.BackgroundCallback; -import org.apache.curator.framework.api.CuratorEvent; -import org.apache.curator.framework.api.CuratorEventType; -import org.apache.curator.framework.api.CuratorWatcher; +import org.apache.curator.framework.recipes.cache.NodeCache; +import org.apache.curator.framework.recipes.cache.NodeCacheListener; import org.apache.curator.framework.state.ConnectionState; import org.apache.curator.framework.state.ConnectionStateListener; import org.apache.curator.utils.CloseableUtils; @@ -44,7 +42,6 @@ import org.apache.curator.x.discovery.ServiceType; import org.apache.curator.x.discovery.strategies.RoundRobinStrategy; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; -import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,9 +61,9 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT private final String basePath; private final InstanceSerializerT serializer; private final MapString, ServiceInstanceT services = Maps.newConcurrentMap(); +private final MapString, NodeCache watchedServices; private final CollectionServiceCacheT caches = Sets.newSetFromMap(Maps.ServiceCacheT, BooleannewConcurrentMap()); private final CollectionServiceProviderT providers = Sets.newSetFromMap(Maps.ServiceProviderT, BooleannewConcurrentMap()); -private final boolean watchInstances; private final ConnectionStateListener connectionStateListener = new ConnectionStateListener() { @Override @@ -96,13 +93,13 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT */ public ServiceDiscoveryImpl(CuratorFramework client, String basePath, InstanceSerializerT serializer, ServiceInstanceT thisInstance, boolean watchInstances) { -this.watchInstances = watchInstances; this.client = Preconditions.checkNotNull(client, client cannot be null); this.basePath = Preconditions.checkNotNull(basePath, basePath cannot be null); this.serializer = Preconditions.checkNotNull(serializer, serializer cannot be null); +watchedServices = watchInstances ? Maps.String, NodeCachenewConcurrentMap() : null; if ( thisInstance != null ) { -services.put(thisInstance.getId(), thisInstance); +setService(thisInstance); } } @@ -129,6 +126,13 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT { CloseableUtils.closeQuietly(provider); } +if ( watchedServices != null ) +{ +for ( NodeCache nodeCache : watchedServices.values() ) +{ +CloseableUtils.closeQuietly(nodeCache); +} +} IteratorServiceInstanceT it = services.values().iterator(); while ( it.hasNext() ) @@ -171,7 +175,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void registerService(ServiceInstanceT service) throws Exception { -services.put
[2/2] curator git commit: Added a way to watch registered services so that tools such as admin consoles can change values and have SD recognize the changes
Added a way to watch registered services so that tools such as admin consoles can change values and have SD recognize the changes Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/37dc4478 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/37dc4478 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/37dc4478 Branch: refs/heads/CURATOR-176 Commit: 37dc4478597c6db0dcab83b636318b51bb389c58 Parents: 742e092 Author: randgalt randg...@apache.org Authored: Sun Jan 4 17:03:29 2015 -0500 Committer: randgalt randg...@apache.org Committed: Sun Jan 4 17:03:29 2015 -0500 -- .../x/discovery/ServiceDiscoveryBuilder.java| 45 +++ .../discovery/details/ServiceDiscoveryImpl.java | 59 +-- .../x/discovery/TestServiceDiscovery.java | 79 ++-- .../discovery/details/TestWatchedInstances.java | 76 +++ 4 files changed, 200 insertions(+), 59 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/37dc4478/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscoveryBuilder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscoveryBuilder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscoveryBuilder.java index 2b972ca..e25fc67 100644 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscoveryBuilder.java +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscoveryBuilder.java @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.curator.x.discovery; import org.apache.curator.framework.CuratorFramework; @@ -25,20 +26,21 @@ import org.apache.curator.x.discovery.details.ServiceDiscoveryImpl; public class ServiceDiscoveryBuilderT { -private CuratorFrameworkclient; -private String basePath; -private InstanceSerializerT serializer; -private ServiceInstanceT thisInstance; -private ClassTpayloadClass; +private CuratorFramework client; +private String basePath; +private InstanceSerializerT serializer; +private ServiceInstanceT thisInstance; +private ClassT payloadClass; +private boolean watchInstances = false; /** * Return a new builder. * * @param payloadClass the class of the payload of your service instance (you can use {@link Void} - * if your instances don't need a payload) + * if your instances don't need a payload) * @return new builder */ -public staticT ServiceDiscoveryBuilderT builder(ClassT payloadClass) +public static T ServiceDiscoveryBuilderT builder(ClassT payloadClass) { return new ServiceDiscoveryBuilderT(payloadClass); } @@ -49,12 +51,13 @@ public class ServiceDiscoveryBuilderT * * @return new service discovery */ -public ServiceDiscoveryT build() +public ServiceDiscoveryT build() { -if ( serializer == null ) { +if ( serializer == null ) +{ serializer(new JsonInstanceSerializerT(payloadClass)); } -return new ServiceDiscoveryImplT(client, basePath, serializer, thisInstance); +return new ServiceDiscoveryImplT(client, basePath, serializer, thisInstance, watchInstances); } /** @@ -63,7 +66,7 @@ public class ServiceDiscoveryBuilderT * @param client client * @return this */ -public ServiceDiscoveryBuilderT client(CuratorFramework client) +public ServiceDiscoveryBuilderT client(CuratorFramework client) { this.client = client; return this; @@ -75,7 +78,7 @@ public class ServiceDiscoveryBuilderT * @param basePath base path * @return this */ -public ServiceDiscoveryBuilderT basePath(String basePath) +public ServiceDiscoveryBuilderT basePath(String basePath) { this.basePath = basePath; return this; @@ -87,7 +90,7 @@ public class ServiceDiscoveryBuilderT * @param serializer the serializer * @return this */ -public ServiceDiscoveryBuilderT serializer(InstanceSerializerT serializer) +public ServiceDiscoveryBuilderT serializer(InstanceSerializerT serializer) { this.serializer = serializer; return this; @@ -99,12 +102,26 @@ public class ServiceDiscoveryBuilderT * @param thisInstance initial instance * @return this */ -public ServiceDiscoveryBuilderT thisInstance(ServiceInstanceT thisInstance) +public ServiceDiscoveryBuilderT thisInstance(ServiceInstanceT
[1/2] curator git commit: updateService() doesn't need to validate the service exists in the local services cache
Repository: curator Updated Branches: refs/heads/CURATOR-176 [created] 37dc44785 updateService() doesn't need to validate the service exists in the local services cache Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/742e0927 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/742e0927 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/742e0927 Branch: refs/heads/CURATOR-176 Commit: 742e092756722f34276d55cfb139d20aa681b908 Parents: 3eea676 Author: randgalt randg...@apache.org Authored: Tue Dec 30 14:26:46 2014 -0500 Committer: randgalt randg...@apache.org Committed: Tue Dec 30 14:26:46 2014 -0500 -- .../apache/curator/x/discovery/details/ServiceDiscoveryImpl.java | 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/742e0927/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 ad6ce89..a55f678 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 @@ -173,8 +173,6 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void updateService(ServiceInstanceT service) throws Exception { -Preconditions.checkArgument(services.containsKey(service.getId()), Service is not registered: + service); - byte[] bytes = serializer.serialize(service); String path = pathForInstance(service.getName(), service.getId()); client.setData().forPath(path, bytes);
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 backgr
Repository: curator Updated Branches: refs/heads/CURATOR-168 [created] c805679c8 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-168 Commit: c805679c8d4307360710a24cddc071cbbcb5ca75 Parents: c9a5c4a Author: randgalt randg...@apache.org Authored: Mon Apr 20 20:16:40 2015 -0500 Committer: randgalt randg...@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, BackgroundOperationPathAndByt }; } +@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, BackgroundOperationPathAndByt 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, BackgroundOperationPathAndByt { 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, BackgroundOperationPathAndByt @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, BackgroundOperationPathAndByt 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
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 backgr
Repository: curator Updated Branches: refs/heads/master c9a5c4a23 - c805679c8 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/master Commit: c805679c8d4307360710a24cddc071cbbcb5ca75 Parents: c9a5c4a Author: randgalt randg...@apache.org Authored: Mon Apr 20 20:16:40 2015 -0500 Committer: randgalt randg...@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, BackgroundOperationPathAndByt }; } +@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, BackgroundOperationPathAndByt 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, BackgroundOperationPathAndByt { 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, BackgroundOperationPathAndByt @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, BackgroundOperationPathAndByt 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
curator git commit: fixed bad license headers
Repository: curator Updated Branches: refs/heads/master c805679c8 - 2db9a6df9 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/master Commit: 2db9a6df95b8dcbe17de64fb89100bd3b7a5469b Parents: c805679 Author: randgalt randg...@apache.org Authored: Mon Apr 20 21:19:38 2015 -0500 Committer: randgalt randg...@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;
curator git commit: when unregistering a service remove it from the internal map first and then delete (guaranteed) the node
Repository: curator Updated Branches: refs/heads/CURATOR-164 [created] 915d83add when unregistering a service remove it from the internal map first and then delete (guaranteed) the node Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/915d83ad Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/915d83ad Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/915d83ad Branch: refs/heads/CURATOR-164 Commit: 915d83add911d624ab3584508f566344827fbae6 Parents: c65e091 Author: randgalt randg...@apache.org Authored: Tue Apr 21 12:31:17 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 12:31:17 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 62 .../x/discovery/TestServiceDiscovery.java | 74 +++- 2 files changed, 103 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/915d83ad/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 41c5d77..824eb75 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 @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.curator.x.discovery.details; import com.google.common.annotations.VisibleForTesting; @@ -149,7 +150,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT ServiceInstanceT service = it.next(); String path = pathForInstance(service.getName(), service.getId()); boolean doRemove = true; - + try { client.delete().forPath(path); @@ -163,13 +164,13 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT doRemove = false; log.error(Could not unregister instance: + service.getName(), e); } - + if ( doRemove ) { it.remove(); } } - + client.getConnectionStateListenable().removeListener(connectionStateListener); } @@ -189,25 +190,25 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void updateService(ServiceInstanceT service) throws Exception { -byte[] bytes = serializer.serialize(service); -String path = pathForInstance(service.getName(), service.getId()); +byte[] bytes = serializer.serialize(service); +String path = pathForInstance(service.getName(), service.getId()); client.setData().forPath(path, bytes); services.put(service.getId(), service); } @VisibleForTesting -protected void internalRegisterService(ServiceInstanceT service) throws Exception +protected void internalRegisterService(ServiceInstanceT service) throws Exception { -byte[] bytes = serializer.serialize(service); -String path = pathForInstance(service.getName(), service.getId()); +byte[] bytes = serializer.serialize(service); +String path = pathForInstance(service.getName(), service.getId()); -final int MAX_TRIES = 2; -boolean isDone = false; +final int MAX_TRIES = 2; +boolean isDone = false; for ( int i = 0; !isDone (i MAX_TRIES); ++i ) { try { -CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT; +CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT; client.create().creatingParentsIfNeeded().withMode(mode).forPath(path, bytes); isDone = true; } @@ -225,18 +226,19 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT * @throws Exception errors */ @Override -public void unregisterService(ServiceInstanceT service) throws Exception +public void unregisterService(ServiceInstanceT service) throws Exception { -String path = pathForInstance(service.getName(), service.getId()); +services.remove(service.getId()); + +String path = pathForInstance(service.getName
curator git commit: set watched instances to true to check that as well
Repository: curator Updated Branches: refs/heads/CURATOR-164 915d83add - 0178c8303 set watched instances to true to check that as well Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0178c830 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0178c830 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0178c830 Branch: refs/heads/CURATOR-164 Commit: 0178c830385854bb8737afba301c7896604e4547 Parents: 915d83a Author: randgalt randg...@apache.org Authored: Tue Apr 21 12:35:23 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 12:35:23 2015 -0500 -- .../org/apache/curator/x/discovery/TestServiceDiscovery.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/0178c830/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 40d491a..3b45494 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 @@ -340,7 +340,7 @@ public class TestServiceDiscovery extends BaseClassForTests client.start(); ServiceInstanceString instance = ServiceInstance.Stringbuilder().payload(thing).name(name).port(10064).build(); -ServiceDiscoveryString discovery = ServiceDiscoveryBuilder.builder(String.class).basePath(/test).client(client).thisInstance(instance).serializer(slowSerializer).build(); +ServiceDiscoveryString discovery = ServiceDiscoveryBuilder.builder(String.class).basePath(/test).client(client).thisInstance(instance).serializer(slowSerializer).watchInstances(true).build(); closeables.add(discovery); discovery.start(); @@ -352,7 +352,7 @@ public class TestServiceDiscovery extends BaseClassForTests discovery.unregisterService(instance); restartLatch.countDown(); -TimeUnit.SECONDS.sleep(1); // Wait for the rest of registration to finish. +new Timing().sleepABit(); // Wait for the rest of registration to finish. Assert.assertTrue(discovery.queryForInstances(name).isEmpty(), Service should have unregistered.); }
[1/3] curator git commit: Port Codehaus Jackson to fasterxml Jackson.
Repository: curator Updated Branches: refs/heads/master 5f291bbcb - 2347b57d5 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/master Commit: 4bd2c0bfb516f23c8ca168642cf43f6a1822fbd9 Parents: febfcec Author: Mark Petrovic mark.petro...@xoom.com Authored: Wed Jan 21 16:28:00 2015 -0800 Committer: Mark Petrovic mark.petro...@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 GenericDiscoveryContextT implements DiscoveryContextT, ContextR T payload; ObjectMapper mapper = new ObjectMapper(); //noinspection
[3/3] curator git commit: Merge branch 'CURATOR-186'
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/master Commit: 2347b57d526b79680dd340462722f72286661670 Parents: 5f291bb de23cae Author: randgalt randg...@apache.org Authored: Tue Apr 21 10:57:31 2015 -0500 Committer: randgalt randg...@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(-) --
[1/4] curator git commit: make sure ChildReaper always moves through all registered nodes. Also, add an optionl check so that large nodes are never queried
Repository: curator Updated Branches: refs/heads/master 2db9a6df9 - 5f291bbcb 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/master Commit: 7fe94bb1517fa32dcb2e1972ada9b7b493c1108b Parents: 6a56c51 Author: randgalt randg...@apache.org Authored: Mon Apr 6 16:41:24 2015 -0500 Committer: randgalt randg...@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 AtomicReferenceState state = new AtomicReferenceState(State.LATENT); private final CuratorFramework client; private final CollectionString paths = Sets.newConcurrentHashSet(); +private volatile IteratorString pathIterator = null; private final Reaper.Mode mode; private final CloseableScheduledExecutorService executor; private final int reapingThresholdMs; private final LeaderLatch leaderLatch; private final SetString 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/100 + * + * @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
[4/4] curator git commit: Merge branch 'CURATOR-203'
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/master Commit: 5f291bbcb3cc219575e906dde0a0c112b5bfa7d7 Parents: 2db9a6d 9ab4668 Author: randgalt randg...@apache.org Authored: Tue Apr 21 10:31:04 2015 -0500 Committer: randgalt randg...@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(-) --
[2/4] curator git commit: doc update
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/master Commit: dd03a63132e5ffe97dba7f1a5b80d72e04a544e7 Parents: 7fe94bb Author: randgalt randg...@apache.org Authored: Mon Apr 6 17:27:45 2015 -0500 Committer: randgalt randg...@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/100 + * be: average-node-name-length/100 * * @param maxChildren max children */
curator git commit: Concurrent registrations/unregistrations and connection issues can cause inconsistent state. Change to a model whereby 'unregistering' an instance doesn't remove it from management
Repository: curator Updated Branches: refs/heads/CURATOR-164 0178c8303 - f489dfebe Concurrent registrations/unregistrations and connection issues can cause inconsistent state. Change to a model whereby 'unregistering' an instance doesn't remove it from management but changes the state. Instance will still be managed for a period of time and clean after a reasonable period Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f489dfeb Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f489dfeb Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f489dfeb Branch: refs/heads/CURATOR-164 Commit: f489dfebeed4ecf004ded37a0f05a0a8a2dc7e6d Parents: 0178c83 Author: randgalt randg...@apache.org Authored: Tue Apr 21 15:13:26 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 15:13:26 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 190 ++--- .../x/discovery/TestServiceDiscovery.java | 368 - .../discovery/details/TestServiceDiscovery.java | 402 +++ 3 files changed, 546 insertions(+), 414 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/f489dfeb/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 824eb75..f53c7ce 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 @@ -50,7 +50,10 @@ import java.io.IOException; import java.util.Collection; import java.util.Iterator; import java.util.List; -import java.util.Map; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; /** * A mechanism to register and query service instances using ZooKeeper @@ -61,10 +64,11 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT private final CuratorFramework client; private final String basePath; private final InstanceSerializerT serializer; -private final MapString, ServiceInstanceT services = Maps.newConcurrentMap(); -private final MapString, NodeCache watchedServices; +private final ConcurrentMapString, HolderT services = Maps.newConcurrentMap(); private final CollectionServiceCacheT caches = Sets.newSetFromMap(Maps.ServiceCacheT, BooleannewConcurrentMap()); private final CollectionServiceProviderT providers = Sets.newSetFromMap(Maps.ServiceProviderT, BooleannewConcurrentMap()); +private final boolean watchInstances; +private final AtomicLong lastCleanMs = new AtomicLong(System.currentTimeMillis()); private final ConnectionStateListener connectionStateListener = new ConnectionStateListener() { @Override @@ -85,6 +89,35 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT } }; +private static final int CLEAN_THRESHOLD_MS = Integer.getInteger(curator-discovery-clean-threshold-ms, (int)TimeUnit.MINUTES.toMillis(5)); + +private enum State +{ +NEW, +REGISTERED, +UNREGISTERED +} + +private static class HolderT +{ +private final AtomicReferenceServiceInstanceT service = new AtomicReferenceServiceInstanceT(); +private final AtomicReferenceNodeCache cache = new AtomicReferenceNodeCache(); +private final AtomicReferenceState state = new AtomicReferenceState(); +private final AtomicLong stateChangeMs = new AtomicLong(); + +public Holder(ServiceInstanceT instance) +{ +service.set(instance); +setState(State.NEW); +} + +public void setState(State state) +{ +this.state.set(state); +stateChangeMs.set(System.currentTimeMillis()); +} +} + /** * @param client the client * @param basePath base path to store data @@ -94,10 +127,10 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT */ public ServiceDiscoveryImpl(CuratorFramework client, String basePath, InstanceSerializerT serializer, ServiceInstanceT thisInstance, boolean watchInstances) { +this.watchInstances = watchInstances; this.client = Preconditions.checkNotNull(client, client cannot be null); this.basePath = Preconditions.checkNotNull(basePath, basePath cannot be null
[2/2] curator git commit: sync on holder for safety during multi-step operations
sync on holder for safety during multi-step operations Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c62b1137 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c62b1137 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c62b1137 Branch: refs/heads/CURATOR-164 Commit: c62b1137fa25104f2e24d65e467d0cfc769bd6e2 Parents: fa0c9da Author: randgalt randg...@apache.org Authored: Tue Apr 21 16:47:10 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 16:47:10 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 86 1 file changed, 53 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/c62b1137/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 80b012e..ba18e42 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 @@ -58,6 +58,7 @@ import java.util.concurrent.atomic.AtomicReference; /** * A mechanism to register and query service instances using ZooKeeper */ +@SuppressWarnings(SynchronizationOnLocalVariableOrMethodParameter) public class ServiceDiscoveryImplT implements ServiceDiscoveryT { private final Logger log = LoggerFactory.getLogger(getClass()); @@ -207,16 +208,19 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT { clean(); -HolderT holder = getOrMakeHolder(service, null); -if ( holder.state.get() == State.UNREGISTERED ) +final HolderT holder = getOrMakeHolder(service, null); +synchronized(holder) { -throw new Exception(Service has been unregistered: + service); -} +if ( holder.state.get() == State.UNREGISTERED ) +{ +throw new Exception(Service has been unregistered: + service); +} -holder.service.set(service); -byte[] bytes = serializer.serialize(service); -String path = pathForInstance(service.getName(), service.getId()); -client.setData().forPath(path, bytes); +holder.service.set(service); +byte[] bytes = serializer.serialize(service); +String path = pathForInstance(service.getName(), service.getId()); +client.setData().forPath(path, bytes); +} } @VisibleForTesting @@ -455,17 +459,27 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @VisibleForTesting ServiceInstanceT getRegisteredService(String id) { -HolderT holder = services.get(id); -return ((holder != null) (holder.state.get() == State.REGISTERED)) ? holder.service.get() : null; +final HolderT holder = services.get(id); +if ( holder != null ) +{ +synchronized(holder) +{ +return (holder.state.get() == State.REGISTERED) ? holder.service.get() : null; +} +} +return null; } private void reRegisterServices() throws Exception { -for ( HolderT service : services.values() ) +for ( final HolderT holder : services.values() ) { -if ( service.state.get() == State.REGISTERED ) +synchronized(holder) { -internalRegisterService(service.service.get()); +if ( holder.state.get() == State.REGISTERED ) +{ +internalRegisterService(holder.service.get()); +} } } } @@ -529,39 +543,45 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT IteratorHolderT iterator = services.values().iterator(); while ( iterator.hasNext() ) { -HolderT holder = iterator.next(); -if ( holder.state.get() == State.UNREGISTERED ) +final HolderT holder = iterator.next(); +synchronized(holder) { -long elapsed = System.currentTimeMillis() - holder.stateChangeMs.get(); -if ( elapsed = CLEAN_THRESHOLD_MS ) +if ( holder.state.get() == State.UNREGISTERED ) { -iterator.remove(); +long elapsed = System.currentTimeMillis() - holder.stateChangeMs.get
curator git commit: removed some unneeded APIs
Repository: curator Updated Branches: refs/heads/CURATOR-164 d6a51f4ae - 166508437 removed some unneeded APIs Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/16650843 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/16650843 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/16650843 Branch: refs/heads/CURATOR-164 Commit: 1665084376546b518965294aab2e32e2ad24d6ac Parents: d6a51f4 Author: randgalt randg...@apache.org Authored: Tue Apr 21 17:49:53 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 17:49:53 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 42 +--- .../discovery/details/ServiceDiscoveryImpl.java | 5 +-- 2 files changed, 4 insertions(+), 43 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/16650843/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java index 69c7667..c126b29 100644 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java @@ -19,8 +19,9 @@ class HolderT private long stateChangeMs; private final ReentrantLock lock = new ReentrantLock(); -Holder(ServiceInstanceT service) +Holder(ServiceInstanceT service, NodeCache nodeCache) { +cache = nodeCache; this.service = service; setState(State.NEW); } @@ -64,19 +65,6 @@ class HolderT } } -NodeCache getCache() -{ -lock.lock(); -try -{ -return cache; -} -finally -{ -lock.unlock(); -} -} - NodeCache getAndClearCache() { lock.lock(); @@ -92,32 +80,6 @@ class HolderT } } -void setCache(NodeCache cache) -{ -lock.lock(); -try -{ -this.cache = cache; -} -finally -{ -lock.unlock(); -} -} - -State getState() -{ -lock.lock(); -try -{ -return state; -} -finally -{ -lock.unlock(); -} -} - boolean isRegistered() { lock.lock(); http://git-wip-us.apache.org/repos/asf/curator/blob/16650843/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 ec049fd..f15a387 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 @@ -185,7 +185,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT holder.getLock().lock(); try { -if ( holder.getState() == Holder.State.UNREGISTERED ) +if ( !holder.isRegistered() ) { throw new Exception(Service has been unregistered: + service); } @@ -516,10 +516,9 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT private HolderT getOrMakeHolder(ServiceInstanceT instance, NodeCache nodeCache) { -HolderT newHolder = new HolderT(instance); +HolderT newHolder = new HolderT(instance, nodeCache); HolderT oldHolder = services.putIfAbsent(instance.getId(), newHolder); HolderT useHolder = (oldHolder != null) ? oldHolder : newHolder; -useHolder.setCache(nodeCache); return useHolder; }
curator git commit: moved holder into separate class so that it's easier to reason about and lock
Repository: curator Updated Branches: refs/heads/CURATOR-164 c62b1137f - d6a51f4ae moved holder into separate class so that it's easier to reason about and lock Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d6a51f4a Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d6a51f4a Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d6a51f4a Branch: refs/heads/CURATOR-164 Commit: d6a51f4ae9a0365fba1ae77b9780d9bb43a79c72 Parents: c62b113 Author: randgalt randg...@apache.org Authored: Tue Apr 21 17:44:53 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 17:44:53 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 173 +++ .../discovery/details/ServiceDiscoveryImpl.java | 120 ++--- .../discovery/details/TestServiceDiscovery.java | 3 - 3 files changed, 227 insertions(+), 69 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/d6a51f4a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java new file mode 100644 index 000..69c7667 --- /dev/null +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java @@ -0,0 +1,173 @@ +package org.apache.curator.x.discovery.details; + +import org.apache.curator.framework.recipes.cache.NodeCache; +import org.apache.curator.x.discovery.ServiceInstance; +import java.util.concurrent.locks.ReentrantLock; + +class HolderT +{ +enum State +{ +NEW, +REGISTERED, +UNREGISTERED +} + +private ServiceInstanceT service; +private NodeCache cache; +private State state; +private long stateChangeMs; +private final ReentrantLock lock = new ReentrantLock(); + +Holder(ServiceInstanceT service) +{ +this.service = service; +setState(State.NEW); +} + +ServiceInstanceT getService() +{ +lock.lock(); +try +{ +return service; +} +finally +{ +lock.unlock(); +} +} + +ServiceInstanceT getServiceIfRegistered() +{ +lock.lock(); +try +{ +return (state == State.REGISTERED) ? service : null; +} +finally +{ +lock.unlock(); +} +} + +void setService(ServiceInstanceT service) +{ +lock.lock(); +try +{ +this.service = service; +} +finally +{ +lock.unlock(); +} +} + +NodeCache getCache() +{ +lock.lock(); +try +{ +return cache; +} +finally +{ +lock.unlock(); +} +} + +NodeCache getAndClearCache() +{ +lock.lock(); +try +{ +NodeCache localCache = cache; +cache = null; +return localCache; +} +finally +{ +lock.unlock(); +} +} + +void setCache(NodeCache cache) +{ +lock.lock(); +try +{ +this.cache = cache; +} +finally +{ +lock.unlock(); +} +} + +State getState() +{ +lock.lock(); +try +{ +return state; +} +finally +{ +lock.unlock(); +} +} + +boolean isRegistered() +{ +lock.lock(); +try +{ +return state == State.REGISTERED; +} +finally +{ +lock.unlock(); +} +} + +boolean isLapsedUnregistered(int cleanThresholdMs) +{ +lock.lock(); +try +{ +if ( state == State.UNREGISTERED ) +{ +long elapsed = System.currentTimeMillis() - stateChangeMs; +if ( elapsed = cleanThresholdMs ) +{ +return true; +} +} +return false; +} +finally +{ +lock.unlock(); +} +} + +void setState(State state) +{ +lock.lock(); +try +{ +this.state = state; +stateChangeMs = System.currentTimeMillis(); +} +finally +{ +lock.unlock(); +} +} + +ReentrantLock getLock() +{ +return lock; +} +} http://git-wip-us.apache.org/repos/asf/curator/blob/d6a51f4a/curator-x-discovery/src/main/java/org/apache
curator git commit: cleanup/refactoring
Repository: curator Updated Branches: refs/heads/CURATOR-164 166508437 - f8b67dc42 cleanup/refactoring Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f8b67dc4 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f8b67dc4 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f8b67dc4 Branch: refs/heads/CURATOR-164 Commit: f8b67dc42d9892b59b5afd52e351c4ef11c4d457 Parents: 1665084 Author: randgalt randg...@apache.org Authored: Tue Apr 21 18:01:34 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 18:01:34 2015 -0500 -- .../main/java/org/apache/curator/x/discovery/details/Holder.java | 3 ++- .../apache/curator/x/discovery/details/ServiceDiscoveryImpl.java | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/f8b67dc4/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java index c126b29..cbc6236 100644 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java @@ -2,6 +2,7 @@ package org.apache.curator.x.discovery.details; import org.apache.curator.framework.recipes.cache.NodeCache; import org.apache.curator.x.discovery.ServiceInstance; +import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; class HolderT @@ -128,7 +129,7 @@ class HolderT } } -ReentrantLock getLock() +Lock getLock() { return lock; } http://git-wip-us.apache.org/repos/asf/curator/blob/f8b67dc4/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 f15a387..8e3e1f9 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 @@ -518,8 +518,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT { HolderT newHolder = new HolderT(instance, nodeCache); HolderT oldHolder = services.putIfAbsent(instance.getId(), newHolder); -HolderT useHolder = (oldHolder != null) ? oldHolder : newHolder; -return useHolder; +return (oldHolder != null) ? oldHolder : newHolder; } private void clean()
curator git commit: fixed bad header
Repository: curator Updated Branches: refs/heads/master 989f94148 - c9a5c4a23 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/master Commit: c9a5c4a234efa7bb684b68452f105dc7dc3cfd09 Parents: 989f941 Author: randgalt randg...@apache.org Authored: Sun Apr 19 14:20:19 2015 -0500 Committer: randgalt randg...@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;
curator git commit: Guaranteed deletes must accept InterruptedException as well as retryable exceptions
Repository: curator Updated Branches: refs/heads/CURATOR-202 [created] 989f94148 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-202 Commit: 989f94148faae97f23368e4b5bae2f1f03eaa62c Parents: 6a56c51 Author: randgalt randg...@apache.org Authored: Sun Apr 19 13:13:45 2015 -0500 Committer: randgalt randg...@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, BackgroundOperationString { -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, BackgroundOperationString guaranteed = false; } -TransactionDeleteBuilderasTransactionDeleteBuilder(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, BackgroundOperationString @Override public void performBackgroundOperation(final OperationAndDataString 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
curator git commit: Guaranteed deletes must accept InterruptedException as well as retryable exceptions
Repository: curator Updated Branches: refs/heads/master 6a56c5145 - 989f94148 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/master Commit: 989f94148faae97f23368e4b5bae2f1f03eaa62c Parents: 6a56c51 Author: randgalt randg...@apache.org Authored: Sun Apr 19 13:13:45 2015 -0500 Committer: randgalt randg...@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, BackgroundOperationString { -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, BackgroundOperationString guaranteed = false; } -TransactionDeleteBuilderasTransactionDeleteBuilder(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, BackgroundOperationString @Override public void performBackgroundOperation(final OperationAndDataString 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
[1/2] curator git commit: CLEAN_THRESHOLD_MS can't be static due to testing
Repository: curator Updated Branches: refs/heads/CURATOR-164 f489dfebe - c62b1137f CLEAN_THRESHOLD_MS can't be static due to testing Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/fa0c9da0 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/fa0c9da0 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/fa0c9da0 Branch: refs/heads/CURATOR-164 Commit: fa0c9da0b022eedc0b0608062433244ad1b3fde5 Parents: f489dfe Author: randgalt randg...@apache.org Authored: Tue Apr 21 15:23:42 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 15:23:42 2015 -0500 -- .../apache/curator/x/discovery/details/ServiceDiscoveryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/fa0c9da0/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 f53c7ce..80b012e 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 @@ -89,7 +89,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT } }; -private static final int CLEAN_THRESHOLD_MS = Integer.getInteger(curator-discovery-clean-threshold-ms, (int)TimeUnit.MINUTES.toMillis(5)); +private final int CLEAN_THRESHOLD_MS = Integer.getInteger(curator-discovery-clean-threshold-ms, (int)TimeUnit.MINUTES.toMillis(5)); private enum State {
[1/2] curator git commit: CURATOR-204 Update parent pom to apache:16
Repository: curator Updated Branches: refs/heads/master 2347b57d5 - 5b24948d2 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/master 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 groupIdorg.apache/groupId artifactIdapache/artifactId -version14/version +version16/version /parent groupIdorg.apache.curator/groupId @@ -62,18 +62,9 @@ !-- versions -- maven-project-info-reports-plugin-version2.7/maven-project-info-reports-plugin-version -maven-javadoc-plugin-version2.9.1/maven-javadoc-plugin-version -maven-dependency-plugin-version2.8/maven-dependency-plugin-version -maven-install-plugin-version2.5.1/maven-install-plugin-version -maven-compiler-plugin-version3.1/maven-compiler-plugin-version maven-bundle-plugin-version2.3.7/maven-bundle-plugin-version -maven-surefire-plugin-version2.17/maven-surefire-plugin-version -maven-site-plugin-version3.3/maven-site-plugin-version doxia-module-confluence-version1.5/doxia-module-confluence-version - maven-scm-publish-plugin-version1.0/maven-scm-publish-plugin-version maven-license-plugin-version1.9.0/maven-license-plugin-version -maven-release-plugin-version2.5/maven-release-plugin-version -apache-rat-plugin-version0.10/apache-rat-plugin-version javassist-version3.18.1-GA/javassist-version commons-math-version2.2/commons-math-version jackson-mapper-asl-version1.9.13/jackson-mapper-asl-version @@ -531,54 +522,12 @@ pluginManagement plugins plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-dependency-plugin/artifactId -version${maven-dependency-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-install-plugin/artifactId -version${maven-install-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-compiler-plugin/artifactId -version${maven-compiler-plugin-version}/version -/plugin - -plugin groupIdorg.apache.felix/groupId artifactIdmaven-bundle-plugin/artifactId version${maven-bundle-plugin-version}/version /plugin plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-surefire-plugin/artifactId -version${maven-surefire-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-javadoc-plugin/artifactId -version${maven-javadoc-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-site-plugin/artifactId -version${maven-site-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-scm-publish-plugin/artifactId -version${maven-scm-publish-plugin-version}/version -/plugin - -plugin groupIdcom.mycila.maven-license-plugin/groupId artifactIdmaven-license-plugin/artifactId version${maven-license-plugin-version}/version @@ -587,7 +536,6 @@ plugin
curator git commit: fixed license header
Repository: curator Updated Branches: refs/heads/master 5b24948d2 - c65e09141 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/master Commit: c65e091417e1da2246203cb9b2cce82ecd87784f Parents: 5b24948 Author: randgalt randg...@apache.org Authored: Tue Apr 21 11:41:34 2015 -0500 Committer: randgalt randg...@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;
[2/2] curator git commit: Merge branch 'CURATOR-204' of github.com:madrob/curator into CURATOR-204
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/master Commit: 5b24948d2385d24132f1059d5bb52f6452e598b6 Parents: 2347b57 6f505c2 Author: randgalt randg...@apache.org Authored: Tue Apr 21 11:17:24 2015 -0500 Committer: randgalt randg...@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-version2.7/maven-project-info-reports-plugin-version - maven-javadoc-plugin-version2.9.1/maven-javadoc-plugin-version - maven-dependency-plugin-version2.8/maven-dependency-plugin-version - maven-install-plugin-version2.5.1/maven-install-plugin-version - maven-compiler-plugin-version3.1/maven-compiler-plugin-version maven-bundle-plugin-version2.3.7/maven-bundle-plugin-version - maven-surefire-plugin-version2.17/maven-surefire-plugin-version - maven-site-plugin-version3.3/maven-site-plugin-version doxia-module-confluence-version1.5/doxia-module-confluence-version - maven-scm-publish-plugin-version1.0/maven-scm-publish-plugin-version maven-license-plugin-version1.9.0/maven-license-plugin-version - maven-release-plugin-version2.5/maven-release-plugin-version - apache-rat-plugin-version0.10/apache-rat-plugin-version javassist-version3.18.1-GA/javassist-version commons-math-version2.2/commons-math-version -jackson-mapper-asl-version1.9.13/jackson-mapper-asl-version +jackson-version2.3.2/jackson-version jersey-version1.18.1/jersey-version jsr311-api-version1.1.1/jsr311-api-version jetty-version6.1.26/jetty-version
[1/2] curator git commit: CURATOR-204 Update parent pom to apache:16
Repository: curator Updated Branches: refs/heads/CURATOR-204 [created] 5b24948d2 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-204 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 groupIdorg.apache/groupId artifactIdapache/artifactId -version14/version +version16/version /parent groupIdorg.apache.curator/groupId @@ -62,18 +62,9 @@ !-- versions -- maven-project-info-reports-plugin-version2.7/maven-project-info-reports-plugin-version -maven-javadoc-plugin-version2.9.1/maven-javadoc-plugin-version -maven-dependency-plugin-version2.8/maven-dependency-plugin-version -maven-install-plugin-version2.5.1/maven-install-plugin-version -maven-compiler-plugin-version3.1/maven-compiler-plugin-version maven-bundle-plugin-version2.3.7/maven-bundle-plugin-version -maven-surefire-plugin-version2.17/maven-surefire-plugin-version -maven-site-plugin-version3.3/maven-site-plugin-version doxia-module-confluence-version1.5/doxia-module-confluence-version - maven-scm-publish-plugin-version1.0/maven-scm-publish-plugin-version maven-license-plugin-version1.9.0/maven-license-plugin-version -maven-release-plugin-version2.5/maven-release-plugin-version -apache-rat-plugin-version0.10/apache-rat-plugin-version javassist-version3.18.1-GA/javassist-version commons-math-version2.2/commons-math-version jackson-mapper-asl-version1.9.13/jackson-mapper-asl-version @@ -531,54 +522,12 @@ pluginManagement plugins plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-dependency-plugin/artifactId -version${maven-dependency-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-install-plugin/artifactId -version${maven-install-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-compiler-plugin/artifactId -version${maven-compiler-plugin-version}/version -/plugin - -plugin groupIdorg.apache.felix/groupId artifactIdmaven-bundle-plugin/artifactId version${maven-bundle-plugin-version}/version /plugin plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-surefire-plugin/artifactId -version${maven-surefire-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-javadoc-plugin/artifactId -version${maven-javadoc-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-site-plugin/artifactId -version${maven-site-plugin-version}/version -/plugin - -plugin -groupIdorg.apache.maven.plugins/groupId -artifactIdmaven-scm-publish-plugin/artifactId -version${maven-scm-publish-plugin-version}/version -/plugin - -plugin groupIdcom.mycila.maven-license-plugin/groupId artifactIdmaven-license-plugin/artifactId version${maven-license-plugin-version}/version @@ -587,7 +536,6 @@ plugin
curator git commit: vast simplication. Holder isn't needed. This is better
Repository: curator Updated Branches: refs/heads/CURATOR-164 1a16f82ba - 03879d1e6 vast simplication. Holder isn't needed. This is better Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/03879d1e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/03879d1e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/03879d1e Branch: refs/heads/CURATOR-164 Commit: 03879d1e627e93bd867bb7a0fdfdd875b033560e Parents: 1a16f82 Author: randgalt randg...@apache.org Authored: Mon Apr 27 15:12:11 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Apr 27 15:12:11 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 72 .../discovery/details/ServiceDiscoveryImpl.java | 163 +++ .../discovery/details/TestServiceDiscovery.java | 5 - 3 files changed, 57 insertions(+), 183 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/03879d1e/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java deleted file mode 100644 index d088f8d..000 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.apache.curator.x.discovery.details; - -import org.apache.curator.framework.recipes.cache.NodeCache; -import org.apache.curator.x.discovery.ServiceInstance; - -class HolderT -{ -enum State -{ -NEW, -REGISTERED, -UNREGISTERED -} - -private ServiceInstanceT service; -private NodeCache cache; -private State state; -private long stateChangeMs; - -Holder(ServiceInstanceT service, NodeCache nodeCache) -{ -cache = nodeCache; -this.service = service; -setState(State.NEW); -} - -synchronized ServiceInstanceT getService() -{ -return service; -} - -synchronized ServiceInstanceT getServiceIfRegistered() -{ -return (state == State.REGISTERED) ? service : null; -} - -synchronized void setService(ServiceInstanceT service) -{ -this.service = service; -} - -synchronized NodeCache getAndClearCache() -{ -NodeCache localCache = cache; -cache = null; -return localCache; -} - -synchronized boolean isRegistered() -{ -return state == State.REGISTERED; -} - -synchronized boolean isLapsedUnregistered(int cleanThresholdMs) -{ -if ( state == State.UNREGISTERED ) -{ -long elapsed = System.currentTimeMillis() - stateChangeMs; -if ( elapsed = cleanThresholdMs ) -{ -return true; -} -} -return false; -} - -synchronized void setState(State state) -{ -this.state = state; -stateChangeMs = System.currentTimeMillis(); -} -} http://git-wip-us.apache.org/repos/asf/curator/blob/03879d1e/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 a35cd3a..7b2a9ec 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 @@ -21,9 +21,7 @@ package org.apache.curator.x.discovery.details; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -50,11 +48,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; /** * A mechanism to register and query service instances using ZooKeeper @@ -66,11 +61,10 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT private final CuratorFramework client; private final String basePath; private final
curator git commit: Use sync instead of locks. It's simpler and clearer
Repository: curator Updated Branches: refs/heads/CURATOR-164 f8b67dc42 - 1a16f82ba Use sync instead of locks. It's simpler and clearer Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/1a16f82b Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1a16f82b Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1a16f82b Branch: refs/heads/CURATOR-164 Commit: 1a16f82baae0360a2823db2cc811fbeb3d6e1392 Parents: f8b67dc Author: randgalt randg...@apache.org Authored: Mon Apr 27 14:51:46 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Apr 27 14:51:46 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 106 --- .../discovery/details/ServiceDiscoveryImpl.java | 24 + 2 files changed, 26 insertions(+), 104 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/1a16f82b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java index cbc6236..d088f8d 100644 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java @@ -2,8 +2,6 @@ package org.apache.curator.x.discovery.details; import org.apache.curator.framework.recipes.cache.NodeCache; import org.apache.curator.x.discovery.ServiceInstance; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; class HolderT { @@ -18,7 +16,6 @@ class HolderT private NodeCache cache; private State state; private long stateChangeMs; -private final ReentrantLock lock = new ReentrantLock(); Holder(ServiceInstanceT service, NodeCache nodeCache) { @@ -27,110 +24,49 @@ class HolderT setState(State.NEW); } -ServiceInstanceT getService() +synchronized ServiceInstanceT getService() { -lock.lock(); -try -{ -return service; -} -finally -{ -lock.unlock(); -} +return service; } -ServiceInstanceT getServiceIfRegistered() +synchronized ServiceInstanceT getServiceIfRegistered() { -lock.lock(); -try -{ -return (state == State.REGISTERED) ? service : null; -} -finally -{ -lock.unlock(); -} +return (state == State.REGISTERED) ? service : null; } -void setService(ServiceInstanceT service) +synchronized void setService(ServiceInstanceT service) { -lock.lock(); -try -{ -this.service = service; -} -finally -{ -lock.unlock(); -} +this.service = service; } -NodeCache getAndClearCache() +synchronized NodeCache getAndClearCache() { -lock.lock(); -try -{ -NodeCache localCache = cache; -cache = null; -return localCache; -} -finally -{ -lock.unlock(); -} +NodeCache localCache = cache; +cache = null; +return localCache; } -boolean isRegistered() +synchronized boolean isRegistered() { -lock.lock(); -try -{ -return state == State.REGISTERED; -} -finally -{ -lock.unlock(); -} +return state == State.REGISTERED; } -boolean isLapsedUnregistered(int cleanThresholdMs) +synchronized boolean isLapsedUnregistered(int cleanThresholdMs) { -lock.lock(); -try +if ( state == State.UNREGISTERED ) { -if ( state == State.UNREGISTERED ) +long elapsed = System.currentTimeMillis() - stateChangeMs; +if ( elapsed = cleanThresholdMs ) { -long elapsed = System.currentTimeMillis() - stateChangeMs; -if ( elapsed = cleanThresholdMs ) -{ -return true; -} +return true; } -return false; -} -finally -{ -lock.unlock(); -} -} - -void setState(State state) -{ -lock.lock(); -try -{ -this.state = state; -stateChangeMs = System.currentTimeMillis(); -} -finally -{ -lock.unlock(); } +return false; } -Lock getLock
curator git commit: closes #72 superceded by PR #73
Repository: curator Updated Branches: refs/heads/master 06af6ff1c - 11d1dd4e5 closes #72 superceded by PR #73 Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/11d1dd4e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/11d1dd4e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/11d1dd4e Branch: refs/heads/master Commit: 11d1dd4e58cedb300271f2c1e9c8dca19722051b Parents: 06af6ff Author: randgalt randg...@apache.org Authored: Mon Apr 27 17:13:14 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Apr 27 17:13:14 2015 -0500 -- --
[01/12] curator git commit: when unregistering a service remove it from the internal map first and then delete (guaranteed) the node
Repository: curator Updated Branches: refs/heads/master 6e16d0d5c - 06af6ff1c when unregistering a service remove it from the internal map first and then delete (guaranteed) the node Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/915d83ad Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/915d83ad Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/915d83ad Branch: refs/heads/master Commit: 915d83add911d624ab3584508f566344827fbae6 Parents: c65e091 Author: randgalt randg...@apache.org Authored: Tue Apr 21 12:31:17 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 12:31:17 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 62 .../x/discovery/TestServiceDiscovery.java | 74 +++- 2 files changed, 103 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/915d83ad/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 41c5d77..824eb75 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 @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.curator.x.discovery.details; import com.google.common.annotations.VisibleForTesting; @@ -149,7 +150,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT ServiceInstanceT service = it.next(); String path = pathForInstance(service.getName(), service.getId()); boolean doRemove = true; - + try { client.delete().forPath(path); @@ -163,13 +164,13 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT doRemove = false; log.error(Could not unregister instance: + service.getName(), e); } - + if ( doRemove ) { it.remove(); } } - + client.getConnectionStateListenable().removeListener(connectionStateListener); } @@ -189,25 +190,25 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void updateService(ServiceInstanceT service) throws Exception { -byte[] bytes = serializer.serialize(service); -String path = pathForInstance(service.getName(), service.getId()); +byte[] bytes = serializer.serialize(service); +String path = pathForInstance(service.getName(), service.getId()); client.setData().forPath(path, bytes); services.put(service.getId(), service); } @VisibleForTesting -protected void internalRegisterService(ServiceInstanceT service) throws Exception +protected void internalRegisterService(ServiceInstanceT service) throws Exception { -byte[] bytes = serializer.serialize(service); -String path = pathForInstance(service.getName(), service.getId()); +byte[] bytes = serializer.serialize(service); +String path = pathForInstance(service.getName(), service.getId()); -final int MAX_TRIES = 2; -boolean isDone = false; +final int MAX_TRIES = 2; +boolean isDone = false; for ( int i = 0; !isDone (i MAX_TRIES); ++i ) { try { -CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT; +CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT; client.create().creatingParentsIfNeeded().withMode(mode).forPath(path, bytes); isDone = true; } @@ -225,18 +226,19 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT * @throws Exception errors */ @Override -public void unregisterService(ServiceInstanceT service) throws Exception +public void unregisterService(ServiceInstanceT service) throws Exception { -String path = pathForInstance(service.getName(), service.getId()); +services.remove(service.getId()); + +String path = pathForInstance(service.getName
[05/12] curator git commit: sync on holder for safety during multi-step operations
sync on holder for safety during multi-step operations Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c62b1137 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c62b1137 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c62b1137 Branch: refs/heads/master Commit: c62b1137fa25104f2e24d65e467d0cfc769bd6e2 Parents: fa0c9da Author: randgalt randg...@apache.org Authored: Tue Apr 21 16:47:10 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 16:47:10 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 86 1 file changed, 53 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/c62b1137/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 80b012e..ba18e42 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 @@ -58,6 +58,7 @@ import java.util.concurrent.atomic.AtomicReference; /** * A mechanism to register and query service instances using ZooKeeper */ +@SuppressWarnings(SynchronizationOnLocalVariableOrMethodParameter) public class ServiceDiscoveryImplT implements ServiceDiscoveryT { private final Logger log = LoggerFactory.getLogger(getClass()); @@ -207,16 +208,19 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT { clean(); -HolderT holder = getOrMakeHolder(service, null); -if ( holder.state.get() == State.UNREGISTERED ) +final HolderT holder = getOrMakeHolder(service, null); +synchronized(holder) { -throw new Exception(Service has been unregistered: + service); -} +if ( holder.state.get() == State.UNREGISTERED ) +{ +throw new Exception(Service has been unregistered: + service); +} -holder.service.set(service); -byte[] bytes = serializer.serialize(service); -String path = pathForInstance(service.getName(), service.getId()); -client.setData().forPath(path, bytes); +holder.service.set(service); +byte[] bytes = serializer.serialize(service); +String path = pathForInstance(service.getName(), service.getId()); +client.setData().forPath(path, bytes); +} } @VisibleForTesting @@ -455,17 +459,27 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @VisibleForTesting ServiceInstanceT getRegisteredService(String id) { -HolderT holder = services.get(id); -return ((holder != null) (holder.state.get() == State.REGISTERED)) ? holder.service.get() : null; +final HolderT holder = services.get(id); +if ( holder != null ) +{ +synchronized(holder) +{ +return (holder.state.get() == State.REGISTERED) ? holder.service.get() : null; +} +} +return null; } private void reRegisterServices() throws Exception { -for ( HolderT service : services.values() ) +for ( final HolderT holder : services.values() ) { -if ( service.state.get() == State.REGISTERED ) +synchronized(holder) { -internalRegisterService(service.service.get()); +if ( holder.state.get() == State.REGISTERED ) +{ +internalRegisterService(holder.service.get()); +} } } } @@ -529,39 +543,45 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT IteratorHolderT iterator = services.values().iterator(); while ( iterator.hasNext() ) { -HolderT holder = iterator.next(); -if ( holder.state.get() == State.UNREGISTERED ) +final HolderT holder = iterator.next(); +synchronized(holder) { -long elapsed = System.currentTimeMillis() - holder.stateChangeMs.get(); -if ( elapsed = CLEAN_THRESHOLD_MS ) +if ( holder.state.get() == State.UNREGISTERED ) { -iterator.remove(); +long elapsed = System.currentTimeMillis() - holder.stateChangeMs.get
[06/12] curator git commit: moved holder into separate class so that it's easier to reason about and lock
moved holder into separate class so that it's easier to reason about and lock Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d6a51f4a Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d6a51f4a Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d6a51f4a Branch: refs/heads/master Commit: d6a51f4ae9a0365fba1ae77b9780d9bb43a79c72 Parents: c62b113 Author: randgalt randg...@apache.org Authored: Tue Apr 21 17:44:53 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 17:44:53 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 173 +++ .../discovery/details/ServiceDiscoveryImpl.java | 120 ++--- .../discovery/details/TestServiceDiscovery.java | 3 - 3 files changed, 227 insertions(+), 69 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/d6a51f4a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java new file mode 100644 index 000..69c7667 --- /dev/null +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java @@ -0,0 +1,173 @@ +package org.apache.curator.x.discovery.details; + +import org.apache.curator.framework.recipes.cache.NodeCache; +import org.apache.curator.x.discovery.ServiceInstance; +import java.util.concurrent.locks.ReentrantLock; + +class HolderT +{ +enum State +{ +NEW, +REGISTERED, +UNREGISTERED +} + +private ServiceInstanceT service; +private NodeCache cache; +private State state; +private long stateChangeMs; +private final ReentrantLock lock = new ReentrantLock(); + +Holder(ServiceInstanceT service) +{ +this.service = service; +setState(State.NEW); +} + +ServiceInstanceT getService() +{ +lock.lock(); +try +{ +return service; +} +finally +{ +lock.unlock(); +} +} + +ServiceInstanceT getServiceIfRegistered() +{ +lock.lock(); +try +{ +return (state == State.REGISTERED) ? service : null; +} +finally +{ +lock.unlock(); +} +} + +void setService(ServiceInstanceT service) +{ +lock.lock(); +try +{ +this.service = service; +} +finally +{ +lock.unlock(); +} +} + +NodeCache getCache() +{ +lock.lock(); +try +{ +return cache; +} +finally +{ +lock.unlock(); +} +} + +NodeCache getAndClearCache() +{ +lock.lock(); +try +{ +NodeCache localCache = cache; +cache = null; +return localCache; +} +finally +{ +lock.unlock(); +} +} + +void setCache(NodeCache cache) +{ +lock.lock(); +try +{ +this.cache = cache; +} +finally +{ +lock.unlock(); +} +} + +State getState() +{ +lock.lock(); +try +{ +return state; +} +finally +{ +lock.unlock(); +} +} + +boolean isRegistered() +{ +lock.lock(); +try +{ +return state == State.REGISTERED; +} +finally +{ +lock.unlock(); +} +} + +boolean isLapsedUnregistered(int cleanThresholdMs) +{ +lock.lock(); +try +{ +if ( state == State.UNREGISTERED ) +{ +long elapsed = System.currentTimeMillis() - stateChangeMs; +if ( elapsed = cleanThresholdMs ) +{ +return true; +} +} +return false; +} +finally +{ +lock.unlock(); +} +} + +void setState(State state) +{ +lock.lock(); +try +{ +this.state = state; +stateChangeMs = System.currentTimeMillis(); +} +finally +{ +lock.unlock(); +} +} + +ReentrantLock getLock() +{ +return lock; +} +} http://git-wip-us.apache.org/repos/asf/curator/blob/d6a51f4a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
[02/12] curator git commit: set watched instances to true to check that as well
set watched instances to true to check that as well Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0178c830 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0178c830 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0178c830 Branch: refs/heads/master Commit: 0178c830385854bb8737afba301c7896604e4547 Parents: 915d83a Author: randgalt randg...@apache.org Authored: Tue Apr 21 12:35:23 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 12:35:23 2015 -0500 -- .../org/apache/curator/x/discovery/TestServiceDiscovery.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/0178c830/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 40d491a..3b45494 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 @@ -340,7 +340,7 @@ public class TestServiceDiscovery extends BaseClassForTests client.start(); ServiceInstanceString instance = ServiceInstance.Stringbuilder().payload(thing).name(name).port(10064).build(); -ServiceDiscoveryString discovery = ServiceDiscoveryBuilder.builder(String.class).basePath(/test).client(client).thisInstance(instance).serializer(slowSerializer).build(); +ServiceDiscoveryString discovery = ServiceDiscoveryBuilder.builder(String.class).basePath(/test).client(client).thisInstance(instance).serializer(slowSerializer).watchInstances(true).build(); closeables.add(discovery); discovery.start(); @@ -352,7 +352,7 @@ public class TestServiceDiscovery extends BaseClassForTests discovery.unregisterService(instance); restartLatch.countDown(); -TimeUnit.SECONDS.sleep(1); // Wait for the rest of registration to finish. +new Timing().sleepABit(); // Wait for the rest of registration to finish. Assert.assertTrue(discovery.queryForInstances(name).isEmpty(), Service should have unregistered.); }
[09/12] curator git commit: Use sync instead of locks. It's simpler and clearer
Use sync instead of locks. It's simpler and clearer Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/1a16f82b Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1a16f82b Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1a16f82b Branch: refs/heads/master Commit: 1a16f82baae0360a2823db2cc811fbeb3d6e1392 Parents: f8b67dc Author: randgalt randg...@apache.org Authored: Mon Apr 27 14:51:46 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Apr 27 14:51:46 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 106 --- .../discovery/details/ServiceDiscoveryImpl.java | 24 + 2 files changed, 26 insertions(+), 104 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/1a16f82b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java index cbc6236..d088f8d 100644 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java @@ -2,8 +2,6 @@ package org.apache.curator.x.discovery.details; import org.apache.curator.framework.recipes.cache.NodeCache; import org.apache.curator.x.discovery.ServiceInstance; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; class HolderT { @@ -18,7 +16,6 @@ class HolderT private NodeCache cache; private State state; private long stateChangeMs; -private final ReentrantLock lock = new ReentrantLock(); Holder(ServiceInstanceT service, NodeCache nodeCache) { @@ -27,110 +24,49 @@ class HolderT setState(State.NEW); } -ServiceInstanceT getService() +synchronized ServiceInstanceT getService() { -lock.lock(); -try -{ -return service; -} -finally -{ -lock.unlock(); -} +return service; } -ServiceInstanceT getServiceIfRegistered() +synchronized ServiceInstanceT getServiceIfRegistered() { -lock.lock(); -try -{ -return (state == State.REGISTERED) ? service : null; -} -finally -{ -lock.unlock(); -} +return (state == State.REGISTERED) ? service : null; } -void setService(ServiceInstanceT service) +synchronized void setService(ServiceInstanceT service) { -lock.lock(); -try -{ -this.service = service; -} -finally -{ -lock.unlock(); -} +this.service = service; } -NodeCache getAndClearCache() +synchronized NodeCache getAndClearCache() { -lock.lock(); -try -{ -NodeCache localCache = cache; -cache = null; -return localCache; -} -finally -{ -lock.unlock(); -} +NodeCache localCache = cache; +cache = null; +return localCache; } -boolean isRegistered() +synchronized boolean isRegistered() { -lock.lock(); -try -{ -return state == State.REGISTERED; -} -finally -{ -lock.unlock(); -} +return state == State.REGISTERED; } -boolean isLapsedUnregistered(int cleanThresholdMs) +synchronized boolean isLapsedUnregistered(int cleanThresholdMs) { -lock.lock(); -try +if ( state == State.UNREGISTERED ) { -if ( state == State.UNREGISTERED ) +long elapsed = System.currentTimeMillis() - stateChangeMs; +if ( elapsed = cleanThresholdMs ) { -long elapsed = System.currentTimeMillis() - stateChangeMs; -if ( elapsed = cleanThresholdMs ) -{ -return true; -} +return true; } -return false; -} -finally -{ -lock.unlock(); -} -} - -void setState(State state) -{ -lock.lock(); -try -{ -this.state = state; -stateChangeMs = System.currentTimeMillis(); -} -finally -{ -lock.unlock(); } +return false; } -Lock getLock() +synchronized void setState(State state) { -return lock; +this.state = state
[07/12] curator git commit: removed some unneeded APIs
removed some unneeded APIs Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/16650843 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/16650843 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/16650843 Branch: refs/heads/master Commit: 1665084376546b518965294aab2e32e2ad24d6ac Parents: d6a51f4 Author: randgalt randg...@apache.org Authored: Tue Apr 21 17:49:53 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 17:49:53 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 42 +--- .../discovery/details/ServiceDiscoveryImpl.java | 5 +-- 2 files changed, 4 insertions(+), 43 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/16650843/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java index 69c7667..c126b29 100644 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java @@ -19,8 +19,9 @@ class HolderT private long stateChangeMs; private final ReentrantLock lock = new ReentrantLock(); -Holder(ServiceInstanceT service) +Holder(ServiceInstanceT service, NodeCache nodeCache) { +cache = nodeCache; this.service = service; setState(State.NEW); } @@ -64,19 +65,6 @@ class HolderT } } -NodeCache getCache() -{ -lock.lock(); -try -{ -return cache; -} -finally -{ -lock.unlock(); -} -} - NodeCache getAndClearCache() { lock.lock(); @@ -92,32 +80,6 @@ class HolderT } } -void setCache(NodeCache cache) -{ -lock.lock(); -try -{ -this.cache = cache; -} -finally -{ -lock.unlock(); -} -} - -State getState() -{ -lock.lock(); -try -{ -return state; -} -finally -{ -lock.unlock(); -} -} - boolean isRegistered() { lock.lock(); http://git-wip-us.apache.org/repos/asf/curator/blob/16650843/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 ec049fd..f15a387 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 @@ -185,7 +185,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT holder.getLock().lock(); try { -if ( holder.getState() == Holder.State.UNREGISTERED ) +if ( !holder.isRegistered() ) { throw new Exception(Service has been unregistered: + service); } @@ -516,10 +516,9 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT private HolderT getOrMakeHolder(ServiceInstanceT instance, NodeCache nodeCache) { -HolderT newHolder = new HolderT(instance); +HolderT newHolder = new HolderT(instance, nodeCache); HolderT oldHolder = services.putIfAbsent(instance.getId(), newHolder); HolderT useHolder = (oldHolder != null) ? oldHolder : newHolder; -useHolder.setCache(nodeCache); return useHolder; }
[04/12] curator git commit: CLEAN_THRESHOLD_MS can't be static due to testing
CLEAN_THRESHOLD_MS can't be static due to testing Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/fa0c9da0 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/fa0c9da0 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/fa0c9da0 Branch: refs/heads/master Commit: fa0c9da0b022eedc0b0608062433244ad1b3fde5 Parents: f489dfe Author: randgalt randg...@apache.org Authored: Tue Apr 21 15:23:42 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 15:23:42 2015 -0500 -- .../apache/curator/x/discovery/details/ServiceDiscoveryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/fa0c9da0/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 f53c7ce..80b012e 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 @@ -89,7 +89,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT } }; -private static final int CLEAN_THRESHOLD_MS = Integer.getInteger(curator-discovery-clean-threshold-ms, (int)TimeUnit.MINUTES.toMillis(5)); +private final int CLEAN_THRESHOLD_MS = Integer.getInteger(curator-discovery-clean-threshold-ms, (int)TimeUnit.MINUTES.toMillis(5)); private enum State {
svn commit: r8837 - in /dev/curator/2.8.0: ./ apache-curator-2.8.0-source-release.zip apache-curator-2.8.0-source-release.zip.asc apache-curator-2.8.0-source-release.zip.md5 apache-curator-2.8.0-sourc
Author: randgalt Date: Wed May 6 00:33:10 2015 New Revision: 8837 Log: Apache Curator 2.8.0 Added: dev/curator/2.8.0/ dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip (with props) dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.asc dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.md5 dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.sha1 Added: dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip == Binary file - no diff available. Propchange: dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip -- svn:mime-type = application/octet-stream Added: dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.asc == --- dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.asc (added) +++ dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.asc Wed May 6 00:33:10 2015 @@ -0,0 +1,17 @@ +-BEGIN PGP SIGNATURE- +Version: GnuPG v2 + +iQIcBAABAgAGBQJVSWChAAoJEJbwkU+I6SakrOYP/jVEKqyx4RKo+Qf4yTIK+/YE +huaNg4Ywz5a8yVQeW4GvHlX0LIcPaelUtUDhXzIiO2XPVb5MO7CD0SthaeZK/jon +nf3Srz8e2nCYYM4BwiGHhvyvqc9kRZkqgjDxbOkXmAIgD/CjfWgH7YC0m7CHMOkk +brwwQseOxBFwcJrF7C7gBgE112eb2FJ91BoBlHfFI9T1+9To9Fmp9jklsUjkwAuD +DNJGNS4RiG15gbF6fw5YsguwOx3iGqkjThMljcvH+ZFcYplYy9lBWZl0A/CrLmTG +B8TewdjwrNtI/OPf2OioMPXKorqfH8voS0rpOJQBAhjXLBgyFHw4ddMxB1KLI8dx +xWjDENScXvhkMxAFjIC1jQ8U+X6CL2oGzW1v4+hG+VYZyeHW+eA+y2N2gdISHT6L +kvnwoj8LFFHKLNxRcGtcSfya0lT4uhPLuTlLdtDVcmCTwY1rHEr49T5jmFsYoTLb +1eimuyEmKnl9x8QO0YHxijaQ6Dt3XO2sJIcCRLwHTayoM26mPAqlcpPy/ra/H5qZ +UYPBvjQteycAMlXrT8CwbHWT54JJYqg8ZHXTmtwUCbhTUTQj2En0rntMGlGaVgGg +yyDLOj4YBTZ9tDR2XNJgrmI702tt5aho0HLCNMtTxwlNW0m8kcJxpLc7JbQ7CH3s +Hq7z59ULO2Hl9VwXd5sK +=GYfa +-END PGP SIGNATURE- Added: dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.md5 == --- dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.md5 (added) +++ dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.md5 Wed May 6 00:33:10 2015 @@ -0,0 +1 @@ +10c81aef5d131a3fae05d69f1488f642 \ No newline at end of file Added: dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.sha1 == --- dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.sha1 (added) +++ dev/curator/2.8.0/apache-curator-2.8.0-source-release.zip.sha1 Wed May 6 00:33:10 2015 @@ -0,0 +1 @@ +ca97d32aaa3e17ff7b83974b48d93a1f0a9a2f9a \ No newline at end of file
[25/50] curator git commit: set watched instances to true to check that as well
set watched instances to true to check that as well Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0178c830 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0178c830 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0178c830 Branch: refs/heads/CURATOR-3.0 Commit: 0178c830385854bb8737afba301c7896604e4547 Parents: 915d83a Author: randgalt randg...@apache.org Authored: Tue Apr 21 12:35:23 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 12:35:23 2015 -0500 -- .../org/apache/curator/x/discovery/TestServiceDiscovery.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/0178c830/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 40d491a..3b45494 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 @@ -340,7 +340,7 @@ public class TestServiceDiscovery extends BaseClassForTests client.start(); ServiceInstanceString instance = ServiceInstance.Stringbuilder().payload(thing).name(name).port(10064).build(); -ServiceDiscoveryString discovery = ServiceDiscoveryBuilder.builder(String.class).basePath(/test).client(client).thisInstance(instance).serializer(slowSerializer).build(); +ServiceDiscoveryString discovery = ServiceDiscoveryBuilder.builder(String.class).basePath(/test).client(client).thisInstance(instance).serializer(slowSerializer).watchInstances(true).build(); closeables.add(discovery); discovery.start(); @@ -352,7 +352,7 @@ public class TestServiceDiscovery extends BaseClassForTests discovery.unregisterService(instance); restartLatch.countDown(); -TimeUnit.SECONDS.sleep(1); // Wait for the rest of registration to finish. +new Timing().sleepABit(); // Wait for the rest of registration to finish. Assert.assertTrue(discovery.queryForInstances(name).isEmpty(), Service should have unregistered.); }
[33/50] curator git commit: Use sync instead of locks. It's simpler and clearer
Use sync instead of locks. It's simpler and clearer Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/1a16f82b Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1a16f82b Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1a16f82b Branch: refs/heads/CURATOR-3.0 Commit: 1a16f82baae0360a2823db2cc811fbeb3d6e1392 Parents: f8b67dc Author: randgalt randg...@apache.org Authored: Mon Apr 27 14:51:46 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Apr 27 14:51:46 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 106 --- .../discovery/details/ServiceDiscoveryImpl.java | 24 + 2 files changed, 26 insertions(+), 104 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/1a16f82b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java index cbc6236..d088f8d 100644 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java +++ b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java @@ -2,8 +2,6 @@ package org.apache.curator.x.discovery.details; import org.apache.curator.framework.recipes.cache.NodeCache; import org.apache.curator.x.discovery.ServiceInstance; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; class HolderT { @@ -18,7 +16,6 @@ class HolderT private NodeCache cache; private State state; private long stateChangeMs; -private final ReentrantLock lock = new ReentrantLock(); Holder(ServiceInstanceT service, NodeCache nodeCache) { @@ -27,110 +24,49 @@ class HolderT setState(State.NEW); } -ServiceInstanceT getService() +synchronized ServiceInstanceT getService() { -lock.lock(); -try -{ -return service; -} -finally -{ -lock.unlock(); -} +return service; } -ServiceInstanceT getServiceIfRegistered() +synchronized ServiceInstanceT getServiceIfRegistered() { -lock.lock(); -try -{ -return (state == State.REGISTERED) ? service : null; -} -finally -{ -lock.unlock(); -} +return (state == State.REGISTERED) ? service : null; } -void setService(ServiceInstanceT service) +synchronized void setService(ServiceInstanceT service) { -lock.lock(); -try -{ -this.service = service; -} -finally -{ -lock.unlock(); -} +this.service = service; } -NodeCache getAndClearCache() +synchronized NodeCache getAndClearCache() { -lock.lock(); -try -{ -NodeCache localCache = cache; -cache = null; -return localCache; -} -finally -{ -lock.unlock(); -} +NodeCache localCache = cache; +cache = null; +return localCache; } -boolean isRegistered() +synchronized boolean isRegistered() { -lock.lock(); -try -{ -return state == State.REGISTERED; -} -finally -{ -lock.unlock(); -} +return state == State.REGISTERED; } -boolean isLapsedUnregistered(int cleanThresholdMs) +synchronized boolean isLapsedUnregistered(int cleanThresholdMs) { -lock.lock(); -try +if ( state == State.UNREGISTERED ) { -if ( state == State.UNREGISTERED ) +long elapsed = System.currentTimeMillis() - stateChangeMs; +if ( elapsed = cleanThresholdMs ) { -long elapsed = System.currentTimeMillis() - stateChangeMs; -if ( elapsed = cleanThresholdMs ) -{ -return true; -} +return true; } -return false; -} -finally -{ -lock.unlock(); -} -} - -void setState(State state) -{ -lock.lock(); -try -{ -this.state = state; -stateChangeMs = System.currentTimeMillis(); -} -finally -{ -lock.unlock(); } +return false; } -Lock getLock() +synchronized void setState(State state) { -return lock; +this.state
[17/50] curator git commit: fixed bad header
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-3.0 Commit: c9a5c4a234efa7bb684b68452f105dc7dc3cfd09 Parents: 989f941 Author: randgalt randg...@apache.org Authored: Sun Apr 19 14:20:19 2015 -0500 Committer: randgalt randg...@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;
[07/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 th
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-3.0 Commit: 9fe802ec238b8ae7b5f77e61cac7e25c8f42f6d9 Parents: 49eb02a Author: Cameron McKenzie came...@unico.com.au Authored: Wed Mar 4 09:09:01 2015 +1100 Committer: Cameron McKenzie came...@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()); + +
Git Push Summary
Repository: curator Updated Tags: refs/tags/apache-curator-2.8.0 [created] 22a045c39
[36/50] curator git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/curator
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/curator Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/06af6ff1 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/06af6ff1 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/06af6ff1 Branch: refs/heads/CURATOR-3.0 Commit: 06af6ff1cc7f4f4de89571dfd7024efe7fd03d38 Parents: 8b250cc 6e16d0d Author: randgalt randg...@apache.org Authored: Mon Apr 27 17:09:46 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Apr 27 17:09:46 2015 -0500 -- .../recipes/nodes/PersistentEphemeralNode.java | 52 +++-- .../nodes/TestPersistentEphemeralNode.java | 82 +++- 2 files changed, 122 insertions(+), 12 deletions(-) --
[44/50] curator git commit: [maven-release-plugin] prepare for next development iteration
[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/4d1af0b5 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4d1af0b5 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4d1af0b5 Branch: refs/heads/CURATOR-3.0 Commit: 4d1af0b5d32f64bb2ab8204fbc01de7c1593cf3e Parents: cf02c82 Author: randgalt randg...@apache.org Authored: Tue May 5 18:56:45 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue May 5 18:56:45 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/4d1af0b5/curator-client/pom.xml -- diff --git a/curator-client/pom.xml b/curator-client/pom.xml index 4eafd2e..50b950f 100644 --- a/curator-client/pom.xml +++ b/curator-client/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-client/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version packagingbundle/packaging nameCurator Client/name http://git-wip-us.apache.org/repos/asf/curator/blob/4d1af0b5/curator-examples/pom.xml -- diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml index cbdd849..85eaaf7 100644 --- a/curator-examples/pom.xml +++ b/curator-examples/pom.xml @@ -24,7 +24,7 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-examples/artifactId http://git-wip-us.apache.org/repos/asf/curator/blob/4d1af0b5/curator-framework/pom.xml -- diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml index a3d2e87..3b3e346 100644 --- a/curator-framework/pom.xml +++ b/curator-framework/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-framework/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version packagingbundle/packaging nameCurator Framework/name http://git-wip-us.apache.org/repos/asf/curator/blob/4d1af0b5/curator-recipes/pom.xml -- diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml index d8c4211..8913b6f 100644 --- a/curator-recipes/pom.xml +++ b/curator-recipes/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-recipes/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version packagingbundle/packaging nameCurator Recipes/name http://git-wip-us.apache.org/repos/asf/curator/blob/4d1af0b5/curator-test/pom.xml -- diff --git a/curator-test/pom.xml b/curator-test/pom.xml index fca1694..d3301ca 100644 --- a/curator-test/pom.xml +++ b/curator-test/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-test/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version nameCurator Testing/name descriptionUnit testing utilities./description http://git-wip-us.apache.org/repos/asf/curator/blob/4d1af0b5/curator-x-discovery-server/pom.xml -- diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml index 453def0..451f46c 100644 --- a/curator-x-discovery-server/pom.xml +++ b/curator-x-discovery-server/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version
[48/50] curator git commit: [maven-release-plugin] prepare for next development iteration
[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/d9362d15 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d9362d15 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d9362d15 Branch: refs/heads/CURATOR-3.0 Commit: d9362d1596f4541ebdc79b1b7ceb410ac19f11cc Parents: 2239cb1 Author: randgalt randg...@apache.org Authored: Tue May 5 19:19:41 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue May 5 19:19:41 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/d9362d15/curator-client/pom.xml -- diff --git a/curator-client/pom.xml b/curator-client/pom.xml index 4eafd2e..50b950f 100644 --- a/curator-client/pom.xml +++ b/curator-client/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-client/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version packagingbundle/packaging nameCurator Client/name http://git-wip-us.apache.org/repos/asf/curator/blob/d9362d15/curator-examples/pom.xml -- diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml index cbdd849..85eaaf7 100644 --- a/curator-examples/pom.xml +++ b/curator-examples/pom.xml @@ -24,7 +24,7 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-examples/artifactId http://git-wip-us.apache.org/repos/asf/curator/blob/d9362d15/curator-framework/pom.xml -- diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml index a3d2e87..3b3e346 100644 --- a/curator-framework/pom.xml +++ b/curator-framework/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-framework/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version packagingbundle/packaging nameCurator Framework/name http://git-wip-us.apache.org/repos/asf/curator/blob/d9362d15/curator-recipes/pom.xml -- diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml index d8c4211..8913b6f 100644 --- a/curator-recipes/pom.xml +++ b/curator-recipes/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-recipes/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version packagingbundle/packaging nameCurator Recipes/name http://git-wip-us.apache.org/repos/asf/curator/blob/d9362d15/curator-test/pom.xml -- diff --git a/curator-test/pom.xml b/curator-test/pom.xml index fca1694..d3301ca 100644 --- a/curator-test/pom.xml +++ b/curator-test/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version /parent artifactIdcurator-test/artifactId -version2.8.0/version +version2.8.1-SNAPSHOT/version nameCurator Testing/name descriptionUnit testing utilities./description http://git-wip-us.apache.org/repos/asf/curator/blob/d9362d15/curator-x-discovery-server/pom.xml -- diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml index 453def0..451f46c 100644 --- a/curator-x-discovery-server/pom.xml +++ b/curator-x-discovery-server/pom.xml @@ -24,11 +24,11 @@ parent groupIdorg.apache.curator/groupId artifactIdapache-curator/artifactId -version2.8.0/version
[22/50] curator git commit: Merge branch 'CURATOR-204' of github.com:madrob/curator into CURATOR-204
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-3.0 Commit: 5b24948d2385d24132f1059d5bb52f6452e598b6 Parents: 2347b57 6f505c2 Author: randgalt randg...@apache.org Authored: Tue Apr 21 11:17:24 2015 -0500 Committer: randgalt randg...@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-version2.7/maven-project-info-reports-plugin-version - maven-javadoc-plugin-version2.9.1/maven-javadoc-plugin-version - maven-dependency-plugin-version2.8/maven-dependency-plugin-version - maven-install-plugin-version2.5.1/maven-install-plugin-version - maven-compiler-plugin-version3.1/maven-compiler-plugin-version maven-bundle-plugin-version2.3.7/maven-bundle-plugin-version - maven-surefire-plugin-version2.17/maven-surefire-plugin-version - maven-site-plugin-version3.3/maven-site-plugin-version doxia-module-confluence-version1.5/doxia-module-confluence-version - maven-scm-publish-plugin-version1.0/maven-scm-publish-plugin-version maven-license-plugin-version1.9.0/maven-license-plugin-version - maven-release-plugin-version2.5/maven-release-plugin-version - apache-rat-plugin-version0.10/apache-rat-plugin-version javassist-version3.18.1-GA/javassist-version commons-math-version2.2/commons-math-version -jackson-mapper-asl-version1.9.13/jackson-mapper-asl-version +jackson-version2.3.2/jackson-version jersey-version1.18.1/jersey-version jsr311-api-version1.1.1/jsr311-api-version jetty-version6.1.26/jetty-version
[23/50] curator git commit: fixed license header
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-3.0 Commit: c65e091417e1da2246203cb9b2cce82ecd87784f Parents: 5b24948 Author: randgalt randg...@apache.org Authored: Tue Apr 21 11:41:34 2015 -0500 Committer: randgalt randg...@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;
[12/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
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-3.0 Commit: 7fe94bb1517fa32dcb2e1972ada9b7b493c1108b Parents: 6a56c51 Author: randgalt randg...@apache.org Authored: Mon Apr 6 16:41:24 2015 -0500 Committer: randgalt randg...@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 AtomicReferenceState state = new AtomicReferenceState(State.LATENT); private final CuratorFramework client; private final CollectionString paths = Sets.newConcurrentHashSet(); +private volatile IteratorString pathIterator = null; private final Reaper.Mode mode; private final CloseableScheduledExecutorService executor; private final int reapingThresholdMs; private final LeaderLatch leaderLatch; private final SetString 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/100 + * + * @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
[20/50] curator git commit: Merge branch 'CURATOR-203'
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-3.0 Commit: 5f291bbcb3cc219575e906dde0a0c112b5bfa7d7 Parents: 2db9a6d 9ab4668 Author: randgalt randg...@apache.org Authored: Tue Apr 21 10:31:04 2015 -0500 Committer: randgalt randg...@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(-) --
[24/50] curator git commit: when unregistering a service remove it from the internal map first and then delete (guaranteed) the node
when unregistering a service remove it from the internal map first and then delete (guaranteed) the node Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/915d83ad Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/915d83ad Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/915d83ad Branch: refs/heads/CURATOR-3.0 Commit: 915d83add911d624ab3584508f566344827fbae6 Parents: c65e091 Author: randgalt randg...@apache.org Authored: Tue Apr 21 12:31:17 2015 -0500 Committer: randgalt randg...@apache.org Committed: Tue Apr 21 12:31:17 2015 -0500 -- .../discovery/details/ServiceDiscoveryImpl.java | 62 .../x/discovery/TestServiceDiscovery.java | 74 +++- 2 files changed, 103 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/915d83ad/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 41c5d77..824eb75 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 @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.curator.x.discovery.details; import com.google.common.annotations.VisibleForTesting; @@ -149,7 +150,7 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT ServiceInstanceT service = it.next(); String path = pathForInstance(service.getName(), service.getId()); boolean doRemove = true; - + try { client.delete().forPath(path); @@ -163,13 +164,13 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT doRemove = false; log.error(Could not unregister instance: + service.getName(), e); } - + if ( doRemove ) { it.remove(); } } - + client.getConnectionStateListenable().removeListener(connectionStateListener); } @@ -189,25 +190,25 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT @Override public void updateService(ServiceInstanceT service) throws Exception { -byte[] bytes = serializer.serialize(service); -String path = pathForInstance(service.getName(), service.getId()); +byte[] bytes = serializer.serialize(service); +String path = pathForInstance(service.getName(), service.getId()); client.setData().forPath(path, bytes); services.put(service.getId(), service); } @VisibleForTesting -protected void internalRegisterService(ServiceInstanceT service) throws Exception +protected void internalRegisterService(ServiceInstanceT service) throws Exception { -byte[] bytes = serializer.serialize(service); -String path = pathForInstance(service.getName(), service.getId()); +byte[] bytes = serializer.serialize(service); +String path = pathForInstance(service.getName(), service.getId()); -final int MAX_TRIES = 2; -boolean isDone = false; +final int MAX_TRIES = 2; +boolean isDone = false; for ( int i = 0; !isDone (i MAX_TRIES); ++i ) { try { -CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT; +CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT; client.create().creatingParentsIfNeeded().withMode(mode).forPath(path, bytes); isDone = true; } @@ -225,18 +226,19 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT * @throws Exception errors */ @Override -public void unregisterService(ServiceInstanceT service) throws Exception +public void unregisterService(ServiceInstanceT service) throws Exception { -String path = pathForInstance(service.getName(), service.getId()); +services.remove(service.getId()); + +String path = pathForInstance(service.getName(), service.getId()); try { -client.delete().forPath(path
[37/50] curator git commit: closes #72 superceded by PR #73
closes #72 superceded by PR #73 Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/11d1dd4e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/11d1dd4e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/11d1dd4e Branch: refs/heads/CURATOR-3.0 Commit: 11d1dd4e58cedb300271f2c1e9c8dca19722051b Parents: 06af6ff Author: randgalt randg...@apache.org Authored: Mon Apr 27 17:13:14 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Apr 27 17:13:14 2015 -0500 -- --
[34/50] curator git commit: vast simplication. Holder isn't needed. This is better
vast simplication. Holder isn't needed. This is better Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/03879d1e Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/03879d1e Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/03879d1e Branch: refs/heads/CURATOR-3.0 Commit: 03879d1e627e93bd867bb7a0fdfdd875b033560e Parents: 1a16f82 Author: randgalt randg...@apache.org Authored: Mon Apr 27 15:12:11 2015 -0500 Committer: randgalt randg...@apache.org Committed: Mon Apr 27 15:12:11 2015 -0500 -- .../curator/x/discovery/details/Holder.java | 72 .../discovery/details/ServiceDiscoveryImpl.java | 163 +++ .../discovery/details/TestServiceDiscovery.java | 5 - 3 files changed, 57 insertions(+), 183 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/03879d1e/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java -- diff --git a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java b/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java deleted file mode 100644 index d088f8d..000 --- a/curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/Holder.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.apache.curator.x.discovery.details; - -import org.apache.curator.framework.recipes.cache.NodeCache; -import org.apache.curator.x.discovery.ServiceInstance; - -class HolderT -{ -enum State -{ -NEW, -REGISTERED, -UNREGISTERED -} - -private ServiceInstanceT service; -private NodeCache cache; -private State state; -private long stateChangeMs; - -Holder(ServiceInstanceT service, NodeCache nodeCache) -{ -cache = nodeCache; -this.service = service; -setState(State.NEW); -} - -synchronized ServiceInstanceT getService() -{ -return service; -} - -synchronized ServiceInstanceT getServiceIfRegistered() -{ -return (state == State.REGISTERED) ? service : null; -} - -synchronized void setService(ServiceInstanceT service) -{ -this.service = service; -} - -synchronized NodeCache getAndClearCache() -{ -NodeCache localCache = cache; -cache = null; -return localCache; -} - -synchronized boolean isRegistered() -{ -return state == State.REGISTERED; -} - -synchronized boolean isLapsedUnregistered(int cleanThresholdMs) -{ -if ( state == State.UNREGISTERED ) -{ -long elapsed = System.currentTimeMillis() - stateChangeMs; -if ( elapsed = cleanThresholdMs ) -{ -return true; -} -} -return false; -} - -synchronized void setState(State state) -{ -this.state = state; -stateChangeMs = System.currentTimeMillis(); -} -} http://git-wip-us.apache.org/repos/asf/curator/blob/03879d1e/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 a35cd3a..7b2a9ec 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 @@ -21,9 +21,7 @@ package org.apache.curator.x.discovery.details; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -50,11 +48,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; /** * A mechanism to register and query service instances using ZooKeeper @@ -66,11 +61,10 @@ public class ServiceDiscoveryImplT implements ServiceDiscoveryT private final CuratorFramework client; private final String basePath; private final InstanceSerializerT serializer; -private final ConcurrentMapString, HolderT
[10/50] curator git commit: Merge branch 'CURATOR-190'
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-3.0 Commit: 6a56c5145bf800498b4f92c0d94eaecf1941bbed Parents: 67b122d 9fe802e Author: Cameron McKenzie came...@unico.com.au Authored: Thu Apr 2 09:11:47 2015 +1100 Committer: Cameron McKenzie came...@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(-) --
[19/50] curator git commit: fixed bad license headers
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-3.0 Commit: 2db9a6df95b8dcbe17de64fb89100bd3b7a5469b Parents: c805679 Author: randgalt randg...@apache.org Authored: Mon Apr 20 21:19:38 2015 -0500 Committer: randgalt randg...@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;
[21/50] curator git commit: Merge branch 'CURATOR-186'
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-3.0 Commit: 2347b57d526b79680dd340462722f72286661670 Parents: 5f291bb de23cae Author: randgalt randg...@apache.org Authored: Tue Apr 21 10:57:31 2015 -0500 Committer: randgalt randg...@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(-) --