@ Override public Result evaluate ( TaskRequest taskRequest , VirtualMachineCurrentState targetVM , TaskTrackerState taskTrackerState ) { Collection < TaskRequest > runningTasks = targetVM . getRunningTasks ( ) ; if ( runningTasks != null && ! runningTasks . isEmpty ( ) ) return new Result ( false , "Already has " + runningTasks . size ( ) + " tasks running on it" ) ; Collection < TaskAssignmentResult > tasksCurrentlyAssigned = targetVM . getTasksCurrentlyAssigned ( ) ; if ( tasksCurrentlyAssigned != null && ! tasksCurrentlyAssigned . isEmpty ( ) ) return new Result ( false , "Already has " + tasksCurrentlyAssigned . size ( ) + " assigned on it" ) ; return new Result ( true , "" ) ; }
Determines whether the prospective host already has tasks either running on it or assigned to be run on it and returns a false Result if either of those things is the case .