惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Latest news
Latest news
H
Help Net Security
C
CERT Recently Published Vulnerability Notes
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Cyber Attacks, Cyber Crime and Cyber Security
Security Latest
Security Latest
B
Blog RSS Feed
V
Vulnerabilities – Threatpost
T
Threatpost
量子位
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cisco Talos Blog
Cisco Talos Blog
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Recorded Future
Recorded Future
博客园 - 聂微东
博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
Forbes - Security
Forbes - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
小众软件
小众软件
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Last Week in AI
Last Week in AI
N
News and Events Feed by Topic
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
PCI Perspectives
PCI Perspectives
T
Tenable Blog
C
Cybersecurity and Infrastructure Security Agency CISA
L
LangChain Blog
SecWiki News
SecWiki News
H
Hacker News: Front Page
WordPress大学
WordPress大学
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Schneier on Security
H
Heimdal Security Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 【当耐特】
A
About on SuperTechFans
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tailwind CSS Blog

博客园 - 但用此心

在CentOS中使用 yum 安装MongoDB及服务器端配置 yum安装mongodb 不错的文章 windows 下,go语言 交叉编译 linux 下 安装go go http 文件下载 go练习5--生成md5 go练习4--json 序列号反序列化 go练习3 --map的操作 go练习2-go的学习资料 go练习1-翻转字符串 php 定界符 mysql 修改默认配置 提高性能 eclipse 的代码着色插件 --Eclipse Color Theme 将tomcat添加为linux系统服务 在centos linux上安装jdk7 使用excel 展现数据库内容 linux 配置 java 环境变量 win7 安装windows 服务 报错 System.Security.SecurityException 解决方法 An exception occurred during the Install phase. System.Security.SecurityException: The so
java 查看线程死锁
但用此心 · 2013-06-03 · via 博客园 - 但用此心

 那我们怎么确定一定是死锁呢?有两种方法。

  1>使用JDK给我们的的工具JConsole,可以通过打开cmd然后输入jconsole打开。

    1)连接到需要查看的进程。

2)打开线程选项卡,然后点击左下角的“检测死锁”

    3)jconsole就会给我们检测出该线程中造成死锁的线程,点击选中即可查看详情:

     从上图中我们可以看出:

      ①在线程Thread-1中,从状态可以看出,它想申请Paper这个资源,但是这个资源已经被Thread-0拥有了,所以就堵塞了。

      ②在线程Thread-0中,从状态可以看出,它想申请Pen这个资源,但是这个资源已经被Thread-1拥有了,所以就堵塞了。

    Thread-1一直等待paper资源,而Thread--一直等待pen资源,于是这两个线程就这么僵持了下去,造成了死锁。

  2>直接使用JVM自带的命令

    1)首先通过 jps 命令查看需要查看的Java进程的vmid,如图,我们要查看的进程TestDeadLock的vmid号是7412;

    

    2)然后利用 jstack 查看该进程中的堆栈情况,在cmd中输入 jstack -l 7412 ,移动到输出的信息的最下面即可得到:

    

    至此,相信大家都会看了吧,具体就不说啦,根据输出,找到问题所在的代码,开始调试解决即可啦。