Java JVM概要分析,线程状态 - “监视”是什么地位意味着什 [英] Java JVM profiling, thread status - what does "Monitor" status mean?

查看:312
本文介绍了Java JVM概要分析,线程状态 - “监视”是什么地位意味着什的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用visualVM连接多线程Java应用程序,线程有4个状态,即运行,休眠,等待,监视。这种监控状态意味着什么? wait和Monitor之间有什么区别?

I use visualVM connect a multi thread Java application, thread has 4 status, namely running, sleeping, wait, Monitor. What does this Monitoring status mean? What's the difference between wait and Monitor?

推荐答案

这些状态与 Thread.State 枚举。 等待意味着,正如文档所说:

These states are the same as mentioned in the Thread.State enum. "Wait" means, as the documentation says:


由于调用以下方法之一,线程处于等待状态:

A thread is in the waiting state due to calling one of the following methods:


  • 没有超时的Object.wait

  • 没有超时的Thread.join

  • LockSupport.park

监视器是已被阻止 state,其中线程正在等待获取对象的锁定(因为它正在尝试输入 synchronized 块或方法,而另一个线程已经持有相关的锁。)

"Monitor" is the BLOCKED state, in which the thread is waiting to obtain a lock on an object (because it's trying to enter a synchronized block or method while another thread already holds the associated lock).

这篇关于Java JVM概要分析,线程状态 - “监视”是什么地位意味着什的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆