public synchronized Optional < BuildTask > getTask ( BuildConfigurationAudited buildConfigAudited ) { Optional < BuildTask > ready = readyTasks . stream ( ) . filter ( bt -> bt . getBuildConfigurationAudited ( ) . equals ( buildConfigAudited ) ) . findAny ( ) ; Optional < BuildTask > waiting = waitingTasksWithCallbacks . keySet ( ) . stream ( ) . filter ( bt -> bt . getBuildConfigurationAudited ( ) . equals ( buildConfigAudited ) ) . findAny ( ) ; Optional < BuildTask > inProgress = tasksInProgress . stream ( ) . filter ( bt -> bt . getBuildConfigurationAudited ( ) . equals ( buildConfigAudited ) ) . findAny ( ) ; return ready . isPresent ( ) ? ready : waiting . isPresent ( ) ? waiting : inProgress ; }
Get build task for given build configuration from the queue .