本博客介绍一下jvisualvm的简单使用教程,jvisualvm功能还是挺多的,不过本博客之简单介绍一下
1、拿线程快照信息
在jdk安装目录找到jvisualvm.exe,${JDK_HOME}/bin/jvisualvm.exe
这里可以看到具体的线程快照信息:
收集后可以看到如图,右键,保存线程快照信息
收集线程快照信息主要是为了监控是否有出现死锁的情况:
观察收集到快照信息,拉到最后看看,如图,就是有出现死锁
再往上看:
这里就列出了对应的死锁情况,根据http-nio-8080-exec-274这些去搜索,定位问题
"http-nio-8080-exec-274":
waiting to lock monitor 0x000000000b0263b0 (object 0x000000070008cbd0, a com.tongweb.log.PassThroughPrintStream),
which is held by "http-nio-8080-exec-87"
"http-nio-8080-exec-87":
waiting to lock monitor 0x0000000029989058 (object 0x00000007000a0fa0, a com.tongweb.web.webutil.util.log.SystemLogHandler),
which is held by "pool-12-thread-2"
"pool-12-thread-2":
waiting to lock monitor 0x0000000026915308 (object 0x00000007000a0fc8, a com.tongweb.log.PassThroughPrintStream),
which is held by "http-nio-8080-exec-85"
"http-nio-8080-exec-85":
waiting to lock monitor 0x0000000029989058 (object 0x00000007000a0fa0, a com.tongweb.web.webutil.util.log.SystemLogHandler),
which is held by "pool-12-thread-2"
2、拿堆栈快照信息
拿堆栈快照信息,如图,选择监控->堆Dump
时间会比较久,需要等待
同样右键->保存,保存堆栈快照信息
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/17034.html