Returns an estimate of the number of threads waiting for the given guard to become satisfied. Note that because timeouts and interrupts may occur at any time, the estimate serves only as an upper bound on the actual number of waiters. This method is designed for use in monitoring of the system state
(Guard guard)
| 952 | |
| 953 | |
| 954 | public int getWaitQueueLength(Guard guard) { |
| 955 | if (guard.monitor != this) { |
| 956 | throw new IllegalMonitorStateException(); |
| 957 | } |
| 958 | lock.lock(); |
| 959 | try { |
| 960 | return guard.waiterCount; |
| 961 | } finally { |
| 962 | lock.unlock(); |
| 963 | } |
| 964 | } |
| 965 | |
| 966 | /** |
| 967 | * Returns unit.toNanos(time), additionally ensuring the returned value is not at risk of |
no test coverage detected