public VoidAggregation nextCandidate ( ) { VoidAggregation result = completedQueue . poll ( ) ; // removing aggregation from tracking table if ( result != null ) { completedCounter . decrementAndGet ( ) ; unpin ( result . getOriginatorId ( ) , result . getTaskId ( ) ) ; } return result ; }
This method returns one of available aggregations if there s at least 1 ready .