我有以下使用 jstack 得到的线程转储,我想知道单词 runnable
旁边的十六进制值显示了什么。我已经看到在其他地方使用的相同值显示为:
waiting on condition [0x00000000796e9000]
这是否意味着其他线程正在等待该线程?
runnable [0x00000000796e9000]
线程转储
"ajp-bio-8009-exec-2925" daemon prio=10 tid=0x0000000015ca7000 nid=0x53c7 runnable [0x00000000796e9000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
最佳答案
I have the following thread dump I get using jstack and would like to know what the hex value next to the word runnable shows. I have seen the same value used in other places showing as:
waiting on condition [0x00000000796e9000]
Does this mean the other threads are waiting on this thread?
是的。这表明一个线程持有锁,而另一个线程正在等待获取该锁。这在概念上与 synchronized 关键字非常相似,但可能更强大(也更复杂)。 查看 condition 的 javadoc以更好地了解情况。
这question/answer在线程转储中给出属性的描述(对于 Java 6)。
关于java - 了解 java 线程转储中的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23817860/