sk0x50 commented on code in PR #4923:
URL: https://github.com/apache/ignite-3/pull/4923#discussion_r1893701006


##########
modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java:
##########
@@ -1297,4 +1316,165 @@ public static boolean 
shouldSwitchToRequestsExecutor(ThreadOperation... required
             return true;
         }
     }
+
+    /**
+     * Performs thread dump and prints all available info to the given log 
with WARN logging level.
+     *
+     * @param log Logger.
+     */
+    public static void dumpThreads(IgniteLogger log) {
+        dumpThreads(log, false);
+    }
+
+    /**
+     * Performs thread dump and prints all available info to the given log
+     * with WARN or ERROR logging level depending on {@code isErrorLevel} 
parameter.
+     *
+     * @param log Logger.
+     * @param isErrorLevel {@code true} if thread dump must be printed with 
ERROR logging level,
+     *      {@code false} if thread dump must be printed with WARN logging 
level.
+     */
+    public static void dumpThreads(IgniteLogger log, boolean isErrorLevel) {
+        ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
+
+        Set<Long> deadlockedThreadsIds = getDeadlockedThreadIds(mxBean);
+
+        if (deadlockedThreadsIds.isEmpty()) {
+            logMessage(log, "No deadlocked threads detected.", isErrorLevel);
+        } else {
+            logMessage(log, "Deadlocked threads detected (see thread dump 
below) "
+                    + "[deadlockedThreadsCnt=" + deadlockedThreadsIds.size() + 
']', isErrorLevel);

Review Comment:
   I always forget that the Ignite 3 code style does not require using 
abbreviations. :) 



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to