public void run ( ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . entry ( tc , "run" ) ; int numPools ; synchronized ( this ) { if ( ivIsCanceled ) { return ; } ivIsRunning = true ; numPools = pools . size ( ) ; if ( numPools > 0 ) { if ( numPools > poolArray . length ) { poolArray = new PoolImplBase [ numPools ] ; } pools . toArray ( poolArray ) ; } } try { for ( int i = 0 ; i < poolArray . length && poolArray [ i ] != null ; ++ i ) // 147140 { if ( poolArray [ i ] . inactive ) { poolArray [ i ] . periodicDrain ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setting inactive: " + poolArray [ i ] ) ; poolArray [ i ] . inactive = true ; } // Allow pools to be GC'ed promptly after being removed. PM54417 poolArray [ i ] = null ; } } finally { synchronized ( this ) { ivIsRunning = false ; if ( ivIsCanceled ) { notify ( ) ; } else if ( ! pools . isEmpty ( ) ) { startAlarm ( ) ; } else { ivScheduledFuture = null ; } } } if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . exit ( tc , "run" ) ; }
Handle the scavenger alarm . Scan the list of pools and drain all inactive ones .