Skip to content

Instantly share code, notes, and snippets.

@peterszatmary
Last active October 24, 2016 20:30
Show Gist options
  • Save peterszatmary/a4814238bef701870d0f3f21ed1f284c to your computer and use it in GitHub Desktop.
Save peterszatmary/a4814238bef701870d0f3f21ed1f284c to your computer and use it in GitHub Desktop.
How to get all currently running threads in java.
public static Thread[] getThreads() {
Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
return threadSet.toArray(new Thread[threadSet.size()]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment