Repository: helix Updated Branches: refs/heads/master 1b268bafd -> 4f8e0be93
Adding an id for the threads created in the ThreadPool of TaskStateModelFactory Project: http://git-wip-us.apache.org/repos/asf/helix/repo Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/4f8e0be9 Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/4f8e0be9 Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/4f8e0be9 Branch: refs/heads/master Commit: 4f8e0be9370480844e297444b9dcc64060ead9d6 Parents: 1b268ba Author: dimuthu <[email protected]> Authored: Wed Apr 11 13:31:14 2018 -0400 Committer: dimuthu <[email protected]> Committed: Tue Apr 17 23:34:11 2018 -0400 ---------------------------------------------------------------------- .../main/java/org/apache/helix/task/TaskStateModelFactory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/helix/blob/4f8e0be9/helix-core/src/main/java/org/apache/helix/task/TaskStateModelFactory.java ---------------------------------------------------------------------- diff --git a/helix-core/src/main/java/org/apache/helix/task/TaskStateModelFactory.java b/helix-core/src/main/java/org/apache/helix/task/TaskStateModelFactory.java index 6d5bd1c..abfe988 100644 --- a/helix-core/src/main/java/org/apache/helix/task/TaskStateModelFactory.java +++ b/helix-core/src/main/java/org/apache/helix/task/TaskStateModelFactory.java @@ -25,6 +25,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.atomic.AtomicInteger; import javax.management.JMException; import org.apache.helix.HelixManager; import org.apache.helix.monitoring.mbeans.ThreadPoolExecutorMonitor; @@ -48,8 +49,9 @@ public class TaskStateModelFactory extends StateModelFactory<TaskStateModel> { public TaskStateModelFactory(HelixManager manager, Map<String, TaskFactory> taskFactoryRegistry) { this(manager, taskFactoryRegistry, Executors.newScheduledThreadPool(TASK_THREADPOOL_SIZE, new ThreadFactory() { + private AtomicInteger threadId = new AtomicInteger(0); @Override public Thread newThread(Runnable r) { - return new Thread(r, "TaskStateModelFactory-task_thread"); + return new Thread(r, "TaskStateModelFactory-task_thread-" + threadId.getAndIncrement()); } })); }
