public enum ThreadState extends java.lang.Enum<ThreadState>
You can nest calls to enter() and exit(), but only the outermost call is used for recording.
It is very important that a matching exit() is always called, so the exit call must be put it a finally block like this:
ThreadState.NETIO.enter();
try {
// your code
} finally {
ThreadState.exit();
}
| Enum Constant and Description |
|---|
BLOCKED
The current thread is blocked on a monitor.
|
NETIO
The current thread is in a Net IO operation.
|
RUNNABLE
The current thread is runnable.
|
WAITING
The current thread is waiting.
|
| Modifier and Type | Method and Description |
|---|---|
void |
enter()
Enters a thread state.
|
static void |
exit()
Exists the current override state and resets the state to the value reported by the JVM.
|
static ThreadState |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static ThreadState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ThreadState RUNNABLE
public static final ThreadState WAITING
public static final ThreadState BLOCKED
public static final ThreadState NETIO
public static ThreadState[] values()
for (ThreadState c : ThreadState.values()) System.out.println(c);
public static ThreadState valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic void enter()
public static void exit()