xintongsong commented on a change in pull request #18148:
URL: https://github.com/apache/flink/pull/18148#discussion_r773568386



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
##########
@@ -693,6 +696,21 @@ JobManagerRunner createJobManagerRunner(JobGraph jobGraph, 
long initializationTi
                                 timeout));
     }
 
+    @Override
+    public CompletableFuture<ThreadDumpInfo> requestThreadDump(Time timeout) {
+        final Collection<ThreadInfo> threadDump = JvmUtils.createThreadDump();
+
+        final Collection<ThreadDumpInfo.ThreadInfo> threadInfos =
+                threadDump.stream()
+                        .map(
+                                threadInfo ->
+                                        ThreadDumpInfo.ThreadInfo.create(
+                                                threadInfo.getThreadName(), 
threadInfo.toString()))
+                        .collect(Collectors.toList());
+
+        return 
CompletableFuture.completedFuture(ThreadDumpInfo.create(threadInfos));
+    }

Review comment:
       This is identical to `TaskExecutor#requestThreadDump`. We can 
deduplicate this by introducing a static method in `ThreadDumpInfo`.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to