List of usage examples for java.lang.management ThreadMXBean getThreadInfo
public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers);
From source file:Main.java
/** * // w w w . j a v a 2 s. c o m */ public static ThreadInfo[] getThreadInfo(long[] ids) { ThreadMXBean bean = ManagementFactory.getThreadMXBean(); return bean.getThreadInfo(ids, true, true); }
From source file:Main.java
private static void printDeadlockInfo(StringBuilder builder, ThreadMXBean bean) { long[] ids = bean.getAllThreadIds(); long[] dds = bean.findDeadlockedThreads(); if (dds != null) { ThreadInfo[] info = bean.getThreadInfo(ids, true, true); builder.append("The following threads are deadlocked:"); for (ThreadInfo ti : info) { builder.append("\t").append(ti); }/*from w ww . ja va 2 s.c o m*/ } }
From source file:hudson.Functions.java
@IgnoreJRERequirement public static ThreadInfo[] getThreadInfos() { ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); return mbean.getThreadInfo(mbean.getAllThreadIds(), mbean.isObjectMonitorUsageSupported(), mbean.isSynchronizerUsageSupported()); }
From source file:org.apache.bookkeeper.common.testing.util.TimedOutTestsListener.java
static String buildDeadlockInfo() { ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); long[] threadIds = threadBean.findMonitorDeadlockedThreads(); if (threadIds != null && threadIds.length > 0) { StringWriter stringWriter = new StringWriter(); PrintWriter out = new PrintWriter(stringWriter); ThreadInfo[] infos = threadBean.getThreadInfo(threadIds, true, true); for (ThreadInfo ti : infos) { printThreadInfo(ti, out);//from w w w .ja v a2 s. c om printLockInfo(ti.getLockedSynchronizers(), out); out.println(); } out.close(); return stringWriter.toString(); } else { return null; } }