How to check is any thread waiting on condition variable?

谁都会走 提交于 2019-12-06 16:58:46

If by "condition" you mean a Condition created by ReentrantLock.newCondition(), then you can use ReentrantLock.hasWaiters(Condition cond).

It's available from the Lock that the Condition is bound to:

http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html

For example:

getWaitingThreads(Condition condition) 
getWaitQueueLength(Condition condition) 

etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!