thread

thread

Synopsis
thread [--groupDump | -g] Display info for all extand Threads
thread <threadName> Display info for the named Thread
Details
The thread command can display information for a single Thread or all Threads that are still extant.

The first form of the command traverses the ThreadGroup hierarchy, displaying information for each Thread that it finds. The information displayed consists of the Thread's 'id', its 'name', its 'priority' and its 'state'. The latter tells you (for example) if the thread is running, waiting on a lock or exited. If the Thread has died with an uncaught exception, you will also see a stacktrace.

If you set the --groupDump flag, the information is produced by calling the "GroupInfo.list()" debug method. The output contains more information but the format is ugly.

The second form of the thread command outputs information for the thread given by the <threadName> argument. No ThreadGroup information is shown.

Bugs
The output does not show the relationship between ThreadGroups unless you use --groupDump.

The second form of the command should set a non-zero return code if it cannot find the requested thread.

There should be a variant for selecting Threads by 'id'.