This is an automated email from the ASF dual-hosted git repository.
jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/master by this push:
new 7ac3123 Dynamically change the processor thread name when consuming event
7ac3123 is described below
commit 7ac3123d25a8851740d179310413d724d0e54c04
Author: Yi Wang <i3.wangyi@gmail.com>
AuthorDate: Tue Jul 23 16:27:59 2019 -0700
Dynamically change the processor thread name when consuming event
---
.../org/apache/helix/controller/GenericHelixController.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
index 6c4f98e..931b4ef 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
@@ -35,7 +35,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import org.I0Itec.zkclient.exception.ZkInterruptedException;
import org.apache.helix.HelixDataAccessor;
@@ -1152,7 +1151,6 @@ public class GenericHelixController implements IdealStateChangeListener,
ClusterEventProcessor(BaseControllerDataProvider cache,
ClusterEventBlockingQueue eventBlockingQueue, String processorName) {
- super("HelixController-pipeline-" + processorName);
_cache = cache;
_eventBlockingQueue = eventBlockingQueue;
_processorName = processorName;
@@ -1165,7 +1163,11 @@ public class GenericHelixController implements IdealStateChangeListener,
+ _processorName);
while (!isInterrupted()) {
try {
- handleEvent(_eventBlockingQueue.take(), _cache);
+ ClusterEvent newClusterEvent = _eventBlockingQueue.take();
+ String threadName = String.format(
+ "HelixController-pipeline-%s-(%s)", _processorName, newClusterEvent.getEventId());
+ this.setName(threadName);
+ handleEvent(newClusterEvent, _cache);
} catch (InterruptedException e) {
logger.warn("ClusterEventProcessor interrupted " + _processorName, e);
interrupt();
@@ -1195,4 +1197,4 @@ public class GenericHelixController implements IdealStateChangeListener,
eventThread.setDaemon(true);
eventThread.start();
}
-}
+}
\ No newline at end of file
|