用Java编写的网络客户端应用程序的套接字读取线程陷入RUNNABLE状态,堆栈跟踪指向Object.notufy()
:
"Socket listener" daemon prio=10 tid=0x00007f6ba98b6000 nid=0x5bfb runnable [0x000000004c1e9000]
java.lang.Thread.State: RUNNABLE
at java.lang.Object.notify(Native Method)
at com.yyy.ClientConnectionImpl$BulkReadOperation.consumeBuffer(ClientConnectionImpl.java:1306)
- locked <0x00000000ee337d30> (a com.yyy.ClientConnectionImpl$BulkReadOperation)
at com.yyy.MessageReceiver.run(MessageReceiver.java:627)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- None
每次打印时都会显示相同的堆栈跟踪。 相关的代码片段如下所示:
public void consumeBuffer (ByteBuffer buffer)
{
if (buffer.remaining() == 0) {
synchronized (this) {
finished = true;
notify (); <<----- line 1306
}
}
}
我正在运行Java 1.7.0_40。
有没有人经历过这样的事情?什么可能导致这种行为?