You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2015/01/12 20:36:26 UTC

[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 <jw...@squareup.com>
Authored: Fri Jan 2 11:55:12 2015 -0500
Committer: Jesse Wilson <jw...@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);
 
             Runnable        command = new Runnable()
             {


[3/3] curator git commit: Added method to provide old behavior

Posted by ra...@apache.org.
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 <ra...@apache.org>
Authored: Mon Jan 12 14:36:13 2015 -0500
Committer: randgalt <ra...@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);


[2/3] curator git commit: Merge branch 'jwilson_0102_name_threads' of https://github.com/swankjesse/curator into CURATOR-177

Posted by ra...@apache.org.
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 <ra...@apache.org>
Authored: Mon Jan 12 14:32:57 2015 -0500
Committer: randgalt <ra...@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(-)
----------------------------------------------------------------------