boolean manageIdlePool ( ThreadPoolExecutor threadPool , long intervalCompleted ) { // Manage the intervalCompleted count if ( intervalCompleted == 0 && threadPool . getActiveCount ( ) == 0 ) { consecutiveIdleCount ++ ; } else { consecutiveIdleCount = 0 ; } if ( consecutiveIdleCount >= IDLE_INTERVALS_BEFORE_PAUSE ) { pause ( ) ; lastAction = LastAction . PAUSE ; return true ; } return false ; }
Determine whether or not the thread pool has been idle long enough to pause the monitoring task .