pkuwm commented on a change in pull request #359: Dynamically change the 
processor thread name when consuming event
URL: https://github.com/apache/helix/pull/359#discussion_r307926024
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
 ##########
 @@ -1152,20 +1151,31 @@ private boolean 
updateControllerState(NotificationContext changeContext, PauseSi
 
     ClusterEventProcessor(BaseControllerDataProvider cache,
         ClusterEventBlockingQueue eventBlockingQueue, String processorName) {
-      super("HelixController-pipeline-" + processorName);
       _cache = cache;
       _eventBlockingQueue = eventBlockingQueue;
       _processorName = processorName;
     }
 
+    private String getThreadName(String eventId) {
+      String threadName = "HelixController-pipeline-" + _processorName;
+      if (!eventId.isEmpty()) {
+        threadName += "(" + eventId + ")";
 
 Review comment:
   An extra String object would be created if going into this branch.  We can 
still use `StringBuilder` to reduce string garbage created because of temporary 
String as a good habit? Though this `getThreadName()` may not be called 
frequently and the performance difference is negligible.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to