public static Map<Long, ThreadState> getThreadStats() {
    Map<Long, ThreadState> threadState = new TreeMap<>();
    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
    for (ThreadInfo thread : threadMXBean.dumpAllThreads(false, false)) {
      threadState.put(thread.getThreadId(), new ThreadState(threadMXBean, thread));
    }
    return threadState;
  }
Returns a map from thread ID to stats about that thread for every thread that has run, even completed ones.
planetiler-core/src/main/java/com/onthegomap/planetiler/stats/ProcessInfo.java