1.查看线程pid,可以使用top命令:
top
2.使用jstack命令dump线程信息(需使用启动当前线程的用户下执行该命令)
jstack 1221 > dump1
3.统计所有线程都处于什么状态:
grep java.lang.Thread.State dump1 | awk '{print $2$3$4$5}' | sort | uniq -c
8 RUNNABLE
2 WAITING(onobjectmonitor)
4.查看dump1具体内容:
cat dump1
读书笔记