public String dumpThreads() {
    StringBuilder dumpWriter = new StringBuilder();

    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
    ThreadInfo[] threadInfos = threadMXBean.getThreadInfo(getThreadIds(), true, true);

    for (ThreadInfo threadInfo : threadInfos) {
      if (threadInfo == null) {
        // sometimes ThreadMXBean.getThreadInfo returns array with one or more null elements
        continue;
      }
      // ThreadInfo toString includes monitor and synchronizer details
      dumpWriter.append(threadInfo);
    }

    return dumpWriter.toString();
  }
Returns thread dumps for the {@code Thread}s that are in the {@code ExecutorService}'s
{@code ThreadGroup} excluding subgroups.

@return thread dumps for the {@code Thread}s that are in the {@code ExecutorService}'s
        {@code ThreadGroup} excluding subgroups
geode-junit/src/main/java/org/apache/geode/test/junit/rules/ExecutorServiceRule.java