You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/11/18 19:30:49 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #8608: Improve naming of threads used in batch source

merlimat commented on a change in pull request #8608:
URL: https://github.com/apache/pulsar/pull/8608#discussion_r526363766



##########
File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/batch/BatchSourceExecutor.java
##########
@@ -69,14 +69,19 @@
   private String intermediateTopicName;
   private volatile Exception currentError = null;
   private volatile boolean isRunning = false;
-  private ExecutorService discoveryThread = Executors.newSingleThreadExecutor(new DefaultThreadFactory("batch-source-discovery"));
+  private ExecutorService discoveryThread;
 
   @Override
   public void open(Map<String, Object> config, SourceContext sourceContext) throws Exception {
     this.config = config;
     this.sourceContext = sourceContext;
     this.intermediateTopicName = SourceConfigUtils.computeBatchSourceIntermediateTopicName(sourceContext.getTenant(),
       sourceContext.getNamespace(), sourceContext.getSourceName()).toString();
+    this.discoveryThread = Executors.newSingleThreadExecutor(
+      new DefaultThreadFactory(
+        String.format("%s-batch-source-discovery",
+          FunctionCommon.getFullyQualifiedName(
+            sourceContext.getTenant(), sourceContext.getNamespace(), sourceContext.getSourceName()))));

Review comment:
       Maybe unrelated, but it would be better to also use `awaitTermination()` in the shutdown, to ensure all pending tasks are gone before we close the classloader.




----------------------------------------------------------------
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