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);