public int getActiveCount ( ) { final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { int n = 0 ; for ( Worker w : workers ) if ( w . isLocked ( ) ) ++ n ; return n ; } finally { mainLock . unlock ( ) ; } }
Returns the approximate number of threads that are actively executing tasks .