public Object execute() throws Exception {
Map<Long, ThreadInfo> threadInfos = new TreeMap<Long, ThreadInfo>();
ThreadMXBean threadsBean = ManagementFactory.getThreadMXBean();
ThreadInfo[] infos;
if (threadsBean.isObjectMonitorUsageSupported() && threadsBean.isSynchronizerUsageSupported()) {
infos = threadsBean.dumpAllThreads(true, true);
} else {
infos = threadsBean.getThreadInfo(threadsBean.getAllThreadIds(), Integer.MAX_VALUE);
}
for (ThreadInfo info : infos) {
threadInfos.put(info.getThreadId(), info);