curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [1/3] curator git commit: Use Curator in thread names.
Date Mon, 12 Jan 2015 19:36:26 GMT
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 <jwilson@squareup.com>
Authored: Fri Jan 2 11:55:12 2015 -0500
Committer: Jesse Wilson <jwilson@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()
             {


Mime
View raw message