java进程状态
A thread state. A thread can be in one of the following states:
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 callingObject.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.wait
with no timeoutThread.join
with no timeoutLockSupport.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.wait
with timeoutThread.join
with timeoutLockSupport.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
unpark
with 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.
- Some other thread invokes
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
unpark
with 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
- Some other thread invokes
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
unpark
with 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
- Some other thread invokes
java进程状态的更多相关文章
- Linux - 进程状态
ps report a snapshot of the current processes. 能提供一份当前进程的快照,以列表的形式显示正在运行的进程. 列出进程的数量取决于命令所附加的参数,例如:p ...
- Linux - 查看进程状态
ps命令 report a snapshot of the current processes. 能提供一份当前进程的快照,以列表的形式显示正在运行的进程. 列出进程的数量取决于命令所附加的参数,例如 ...
- 由Java正则表达式的灾难性回溯引发的高CPU异常:java.util.regex.Pattern$Loop.match
问题与分析 某天领导report了一个问题:线上的CPU自从上一个版本迭代后就一直处于居高不下的状况,领导看着这段时间的曲线图判断是有两条线程在不停的死循环. 接到任务后去查看了AWS的CloudWa ...
- Java 集群高可用监控(结合阿里SLB)脚本
欢迎点评,大家一起来优化 计划思路: 只有在mysql slave java 进程状态都正常的情况下才允许nginx 运行, 否则就干掉它, 负载用的是阿里的SLB #bin/bash #邮件函数 ...
- log4j的性能瓶颈定位与性能优化(org.apache.log4j.spi.RootLogger) (转)
最近执行一个项目调优,发现使用第三方的Json库导致性能差.原以为问题就这么定位到了,结果去掉Json操作后,性能也不见好转. 现象非常诡异:CPU.内存.网络.磁盘使用率均有剩余,而且压力也是足够的 ...
- 测者的性能测试手册:JVM的监控利器
测者的性能测试手册:JVM的监控利器 每次聊起性能测试,最后的终结话题就是怎么做优化.其实在Java的复杂项目中都会有内存不足问题.内存泄露问题.线程死锁问题.CPU问题.这些问题工程测试或者是小压力 ...
- CentOS下如何根据Dump文件分析线上问题
https://blog.csdn.net/lixin03080/article/details/79711296 一.保存现场 1.记录系统整体资源使用情况,进程信息.线程信息 top -b -n ...
- Hadoop环境搭建 (伪分布式搭建)
一,Hadoop版本下载 建议下载:Hadoop2.5.0 (虽然是老版本,但是在企业级别中运用非常稳定,新版本虽然添加了些小功能但是版本稳定性有带与考核) 1.下载地址: hadoop.apache ...
- Spark案例分析
一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...
随机推荐
- php如何控制用户对图片的访问 PHP禁止图片盗链(转载)
把images目录设置成不充许http访问(把图片目录的:读取.目录浏览 两个权限去掉). 用一个PHP文件,直接用file函数读取这个图片.在这个PHP文件里进行权限控制. apache环境中,在你 ...
- UVa 340 Master-Mind Hints
蛋疼的题目描述,看了好长好长时间才看懂,题目本身是很简单的. Designer给出一串长度为N的Code,Breaker用Guess来破译. 对于两串数字,如果有同一列相等的数字,那么叫做strong ...
- 使用MFC中的AfxBeginThread创建多线程
创建一个基于对话框的工程,工程名为CreateThreadRect 在CreateThreadRect.cpp中增加一个ThreadProc函数,代码如下 工作者线程的函数必须是全局函数或静态 ...
- C实现类封装、继承、多态
1. 概述 C语言是一种面向过程的程序设计语言,而C++是在C语言基础上衍生来了的面向对象的语言,实际上,很多C++实现的底层是用C语言实现的,如在Visual C++中的Interface其实就是 ...
- MIPI DSI 和 D-PHY 初始化序列
MIPI DSI 和 D-PHY 初始化序列 -- 深圳 南山平山村 曾剑锋 参考文档: i.MX 6Dual/6Quad Multimedia Applications Processor Refe ...
- BPMN2新规范与Activiti5
上世纪九十年代以后,随着WfMC联盟的成立,BPM市场群雄逐鹿如火如荼,工作流技术得到了突飞猛进的发展,其中IBM.Oracle等大型软件厂商在工作流领域各扯大旗割据一方.2011年BPMN2.0新规 ...
- fmri分析工具:spm里的统计学 Introduction to SPM statistics
引言 Introduction 需要特别说明,spm是每一个体素为单位,计算统计量,进行t检验. 1.分别在每个体素上做方差分析; 2.对每个体素的方差分析结果,计算t检验统计量; 3.计算等同于t ...
- scala学习笔记(6):闭包
到本章这里,所有函数文本的例子仅参考了传入的参数.例如,(x: Int) => x > 0里,函数体用到的唯一变量,x > 0,是x,被定义为函数参数.然而也可以参考定义在其它地方的 ...
- SpringMVC注解@initbinder解决类型转换问题
在使用SpringMVC的时候,经常会遇到表单中的日期字符串和JavaBean的Date类型的转换,而SpringMVC默认不支持这个格式的转换,所以需要手动配置,自定义数据的绑定才能解决这个问题.在 ...
- MongoDB中shell基本使用
1.创建一个数据库,名为foobar use foobar 这个foobar数据库没有被真正的被创建.只是在mongo的缓存中 但是直接离开的话,这个数据库会被mongo删除. 2.现在我们给foob ...