java.lang.Object java.lang.Enum java.lang.management.ThreadState
Possible states of a thread running in the Java virtual machine. They are virtual machine states which do not reflect any operating system thread states.
The virtual machine states include:
New
Running
Blocked on entering or reentering a synchronization block
Waiting for notification
Timed waiting for notification
Sleeping
Terminated
Other
ThreadInfo
provides other thread information relevant to
thread states. The ThreadInfo.isSuspended()
method tests if
a thread is suspended and the ThreadInfo.isInNative()
method tests
if a thread is executing in native code. The ThreadInfo.getLockName()
returns the monitor lock information if a thread is blocked on
synchronization or waiting for notification associated with an object
(i.e. in an Object.wait
call).
ThreadInfo
,
ThreadMBean.getThreadInfo(long)
Enum Constant Summary | |
---|---|
BLOCKED
Thread state for a thread blocked on entering a synchronization block or blocked on reentering a synchronization block after an Object.wait() call. |
|
NEW
Thread state for a thread which has not yet started. |
|
OTHER
Other thread state. |
|
RUNNING
Thread state for a running thread. |
|
SLEEPING
Thread state for a thread sleeping ( Thread.sleep(long) has been called). |
|
TERMINATED
Thread state for a terminated thread (The thread has completed execution). |
|
TIMED_WAITING
Thread state for a thread waiting for notification with a specified waiting elapsed time. |
|
WAITING
Thread state for a thread waiting for notification. |
Method Summary | |
---|---|
String |
toString()
Returns a String representation of this thread state. |
static ThreadState |
valueOf(String name)
|
static ThreadState[] |
values()
|
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Enum Constant Detail |
---|
public static final ThreadState NEW
public static final ThreadState RUNNING
public static final ThreadState TERMINATED
public static final ThreadState SLEEPING
Thread.sleep(long)
has been called).
public static final ThreadState BLOCKED
Object.wait()
call.
public static final ThreadState WAITING
Object.wait()
or
LockSupport.park()
method will be in
this waiting state.
public static final ThreadState TIMED_WAITING
Object.wait(long)
,
LockSupport.parkNanos(long)
or
LockSupport.parkUntil(long)
method will
be in this timed waiting state.
public static final ThreadState OTHER
Method Detail |
---|
public static final ThreadState[] values()
public static ThreadState valueOf(String name)
public String toString()
toString
in class Enum