java进程状态
2015-10-13 16:37
423 查看
A thread state. A thread can be in one of the following states:
A thread that has not yet started is in this state.
A thread executing in the Java virtual machine is in this state.
A thread that is blocked waiting for a monitor lock is in this state.
A thread that is waiting indefinitely for another thread to perform a particular action is in this state.
A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.
A thread that has exited is in this state.
A thread can be in only one state at a given point in time. These states are virtual machine states which do not reflect any operating system thread states.
Thread state for a thread which has not yet started.
Thread state for a runnable thread. A thread in the runnable state is executing in the Java virtual machine but it may be waiting for other resources from the operating system such as processor.
Thread state for a thread blocked waiting for a monitor lock. A thread in the blocked state is waiting for a monitor lock to enter a synchronized block/method or reenter a synchronized block/method after calling
Thread state for a waiting thread. A thread is in the waiting state due to calling one of the following methods:
A thread in the waiting state is waiting for another thread to perform a particular action. For example, a thread that has called Object.wait() on an object is waiting for another thread to call Object.notify() or Object.notifyAll() on that object. A thread that has calledThread.join() is waiting for a specified thread to terminate.
Thread state for a waiting thread with a specified waiting time. A thread is in the timed waiting state due to calling one of the following methods with a specified positive waiting time:
Thread state for a terminated thread. The thread has completed execution.
Disables the current thread for thread scheduling purposes unless the permit is available.
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
Some other thread invokes
Some other thread interrupts the current thread; or
The call spuriously (that is, for no reason) returns.
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread upon return.
Disables the current thread for thread scheduling purposes, for up to the specified waiting time, unless the permit is available.
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
Some other thread invokes
Some other thread interrupts the current thread; or
The specified waiting time elapses; or
The call spuriously (that is, for no reason) returns.
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the elapsed time upon return.
Parameters:
Disables the current thread for thread scheduling purposes, until the specified deadline, unless the permit is available.
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
Some other thread invokes
Some other thread interrupts the current thread; or
The specified deadline passes; or
The call spuriously (that is, for no reason) returns.
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the current time upon return.
Parameters:
NEW
A thread that has not yet started is in this state.
RUNNABLE
A thread executing in the Java virtual machine is in this state.
BLOCKED
A thread that is blocked waiting for a monitor lock is in this state.
WAITING
A thread that is waiting indefinitely for another thread to perform a particular action is in this state.
TIMED_WAITING
A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.
TERMINATED
A thread that has exited is in this state.
A thread can be in only one state at a given point in time. These states are virtual machine states which do not reflect any operating system thread states.
NEW
public static final Thread.State NEW
Thread state for a thread which has not yet started.
RUNNABLE
public static final Thread.State RUNNABLE
Thread state for a runnable thread. A thread in the runnable state is executing in the Java virtual machine but it may be waiting for other resources from the operating system such as processor.
BLOCKED
public static final Thread.State BLOCKED
Thread state for a thread blocked waiting for a monitor lock. A thread in the blocked state is waiting for a monitor lock to enter a synchronized block/method or reenter a synchronized block/method after calling
Object.wait.
WAITING
public static final Thread.State WAITING
Thread state for a waiting thread. A thread is in the waiting state due to calling one of the following methods:
Object.waitwith no timeout
Thread.joinwith no timeout
LockSupport.park
A thread in the waiting state is waiting for another thread to perform a particular action. For example, a thread that has called Object.wait() on an object is waiting for another thread to call Object.notify() or Object.notifyAll() on that object. A thread that has calledThread.join() is waiting for a specified thread to terminate.
TIMED_WAITING
public static final Thread.State TIMED_WAITING
Thread state for a waiting thread with a specified waiting time. A thread is in the timed waiting state due to calling one of the following methods with a specified positive waiting time:
Thread.sleep
Object.waitwith timeout
Thread.joinwith timeout
LockSupport.parkNanos
LockSupport.parkUntil
TERMINATED
public static final Thread.State TERMINATED
Thread state for a terminated thread. The thread has completed execution.
park
public static void park()
Disables the current thread for thread scheduling purposes unless the permit is available.
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
Some other thread invokes
unparkwith the current thread as the target; or
Some other thread interrupts the current thread; or
The call spuriously (that is, for no reason) returns.
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread upon return.
parkNanos
public static void parkNanos(long nanos)
Disables the current thread for thread scheduling purposes, for up to the specified waiting time, unless the permit is available.
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
Some other thread invokes
unparkwith the current thread as the target; or
Some other thread interrupts the current thread; or
The specified waiting time elapses; or
The call spuriously (that is, for no reason) returns.
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the elapsed time upon return.
Parameters:
nanos- the maximum number of nanoseconds to wait
parkUntil
public static void parkUntil(long deadline)
Disables the current thread for thread scheduling purposes, until the specified deadline, unless the permit is available.
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
Some other thread invokes
unparkwith the current thread as the target; or
Some other thread interrupts the current thread; or
The specified deadline passes; or
The call spuriously (that is, for no reason) returns.
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the current time upon return.
Parameters:
deadline- the absolute time, in milliseconds from the Epoch, to wait until
相关文章推荐
- eclipse中关联jdk、jar包的源码
- javascirpt中偏函数的作用
- java 基础 系列(一)
- Spring Bean 中的线程安全
- Java数组的创建、初始化、使用
- [leetcode-45]Jump Game II(java)
- Java 复制大文件方式FileChannel 用法
- nutz - Molecule类使用方法(Java匿名内部类的传值)
- struts 的文件上传
- highcharts 从后台动态改变数据
- adapter模式 ——java设计模式
- oozie JAVA Client 编程提交作业
- java 验证
- spring的事务详解1
- Java基本基础
- 学习RxJava(资料汇总)
- spring系列之2--对接数据库
- Spring学习笔记(一) 通过Spring控制反转(IOC:Inversion of Control)为对象设置属性
- 老李分享:loadrunner的java user脚本开发
- 老李分享:Eclipse中开发性能测试loadrunner脚本