public final int getQueueLength ( ) { int n = 0 ; for ( Node p = tail ; p != null ; p = p . prev ) { if ( p . thread != null ) ++ n ; } return n ; }
Returns an estimate of the number of threads waiting to acquire . The value is only an estimate because the number of threads may change dynamically while this method traverses internal data structures . This method is designed for use in monitoring system state not for synchronization control .