java.lang.management
Enum ThreadState

java.lang.Object
  extended by java.lang.Enum
      extended by java.lang.management.ThreadState
All Implemented Interfaces:
Comparable, Serializable

public static enum ThreadState
extends Enum<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:

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).

Since:
1.5
See Also:
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

NEW

public static final ThreadState NEW
Thread state for a thread which has not yet started.


RUNNING

public static final ThreadState RUNNING
Thread state for a running thread. A thread in the running state is running in the Java virtual machine but it may be waiting for other resource from the operating system.


TERMINATED

public static final ThreadState TERMINATED
Thread state for a terminated thread (The thread has completed execution).


SLEEPING

public static final ThreadState SLEEPING
Thread state for a thread sleeping (Thread.sleep(long) has been called).


BLOCKED

public static final ThreadState BLOCKED
Thread state for a thread blocked on entering a synchronization block or blocked on reentering a synchronization block after an Object.wait() call.


WAITING

public static final ThreadState WAITING
Thread state for a thread waiting for notification. A thread calling Object.wait() or LockSupport.park() method will be in this waiting state.


TIMED_WAITING

public static final ThreadState TIMED_WAITING
Thread state for a thread waiting for notification with a specified waiting elapsed time. A thread calling Object.wait(long), LockSupport.parkNanos(long) or LockSupport.parkUntil(long) method will be in this timed waiting state.


OTHER

public static final ThreadState OTHER
Other thread state.

Method Detail

values

public static final ThreadState[] values()

valueOf

public static ThreadState valueOf(String name)

toString

public String toString()
Returns a String representation of this thread state.

Overrides:
toString in class Enum
Returns:
a String representation of this thread state.