question: private boolean isNewWorkersRequired ( ) { statsUtil . pollStatsBrokerJobQueue ( ) ; final StatsMessageListener statsMessageListener = statsUtil . getStatsMessageListener ( ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "New worker Required - RequestQueue Stats: " + statsMessageListener . getStats ( ) ) ; } boolean quickSpawnMode = false ; int totalRemoteWorkerSpawned = getNumberOfWorkers ( ) ; int consumerCount = statsMessageListener . getConsumers ( ) ; int remoteWorkerCount = consumerCount - maxConcurrentInVmWorkerCount ; int queueSize = statsMessageListener . getQueueSize ( ) ; if ( verboseLogLevel > 5 ) { Utilities . verboseLog ( "isNewWorkersRequired: maxConsumerSize : " + maxConsumerSize + " TotalConsumers: " + consumerCount + " QueueSize: " + queueSize + " totalRemoteWorkerSpawned: " + totalRemoteWorkerSpawned + " remoteWorkerCount: " + remoteWorkerCount + " queueConsumerRatio: " + queueConsumerRatio + " lifeRemaining: " + lifeRemaining ( ) ) ; } if ( consumerCount < queueSize ) { if ( remoteWorkerCount > 0 ) { quickSpawnMode = ( queueSize / remoteWorkerCount ) > maxConcurrentInVmWorkerCount ; } else { quickSpawnMode = queueSize > maxConcurrentInVmWorkerCount ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "New worker Required  quickSpawnMode: " + quickSpawnMode ) ; } if ( verboseLogLevel > 5 ) { Utilities . verboseLog ( "isNewWorkersRequired: maxConsumerSize : " + maxConsumerSize + " currentRemoteWorkersCount " + remoteWorkerCount + " queueConsumerRatio: " + queueConsumerRatio + " quickSpawnMode: " + quickSpawnMode + " completionTargetMillis: " + lifeRemaining ( ) / completionFactor ) ; } return ( statsMessageListener . newWorkersRequired ( ( int ) ( lifeRemaining ( ) / completionFactor ) ) && ( consumerCount < maxConsumerSize ) && ( consumerCount < queueSize / queueConsumerRatio ) ) || ( quickSpawnMode ) ; } return false ; }
target:  statsMessageListener.newWorkersRequired = expectedCompletionTime() > Liferemaining/completionTargetFactor check if number of remoteConsumers < maxConsumerSize check if number of consumers <  getQueueSize()/queueConsumerRatio