You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@helix.apache.org by GitBox <gi...@apache.org> on 2019/07/26 22:17:02 UTC

[GitHub] [helix] pkuwm commented on a change in pull request #359: Dynamically change the processor thread name when consuming event

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:
users@infra.apache.org


With regards,
Apache Git Services