bharanic-dev commented on a change in pull request #12930:
URL: https://github.com/apache/pulsar/pull/12930#discussion_r762156637



##########
File path: 
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
##########
@@ -73,9 +77,30 @@
 
     protected abstract CompletableFuture<Boolean> existsFromStore(String path);
 
+    // TaskWrapper, wraps the task to be run.
+    // It records the thread on which the task is running. This is to help log 
the stack trace of a
+    // long running task.
+    static private class TaskWrapper implements Runnable {
+
+        private Runnable runnableTask;
+
+        @Getter
+        private volatile Thread taskThread;
+
+        public TaskWrapper(Runnable task) {
+            runnableTask = task;
+        }
+        @Override
+        public void run() {
+            taskThread = Thread.currentThread();
+            runnableTask.run();
+        }
+    }
+
     protected AbstractMetadataStore() {
         this.executor = Executors
                 .newSingleThreadExecutor(new 
DefaultThreadFactory("metadata-store"));
+        this.executorWatchDog = Executors.newSingleThreadExecutor(new 
DefaultThreadFactory("metadata-store-watchdog"));

Review comment:
       @Jason918 separated out the watchdog changes to a new PR, per your 
suggestion: https://github.com/apache/pulsar/pull/13130




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

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to