float refreshAndGetAvg ( ) { long total = 0 ; int count = 0 ; for ( InputChannel channel : inputGate . getInputChannels ( ) . values ( ) ) { if ( channel instanceof RemoteInputChannel ) { RemoteInputChannel rc = ( RemoteInputChannel ) channel ; int size = rc . unsynchronizedGetNumberOfQueuedBuffers ( ) ; total += size ; ++ count ; } } return count == 0 ? 0 : total / ( float ) count ; }
Iterates over all input channels and collects the average number of queued buffers in a channel in a best - effort way .