[英]java.lang.IllegalMonitorStateException on timeout
Is it possible to get java.lang.IllegalMonitorStateException
on notifyAll()
because wait(timeout)
has passed the timeout time? 是否可以在notifyAll()
上获取java.lang.IllegalMonitorStateException
,因为wait(timeout)
已超过超时时间? If not, what happens when notifyAll()
occurs after the timeout time has passed? 如果不是,那么在超时时间过去之后,当notifyAll()
发生时会发生什么? Both notifyAll()
and wait(timeout)
are blocked inside a synchronized block on the same locked object. notifyAll()
和wait(timeout)
都在同一锁定对象上的同步块内被阻塞。
synchronized(lockObj) {
lockObj.notifyAll();
}
And: 和:
synchronized(lockObj) {
lockObj.wait(timeout);
}
No, you won't get an exception for that. 不,您不会因此而例外。 If you call notifyAll
when nothing is waiting, nothing happens basically. 如果没有等待时调用notifyAll
,则基本上不会发生任何事情。 It's not an error condition. 这不是错误条件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.