public boolean addTask ( Task task ) throws SlotNotFoundException , SlotNotActiveException { Preconditions . checkNotNull ( task ) ; TaskSlot taskSlot = getTaskSlot ( task . getAllocationId ( ) ) ; if ( taskSlot != null ) { if ( taskSlot . isActive ( task . getJobID ( ) , task . getAllocationId ( ) ) ) { if ( taskSlot . add ( task ) ) { taskSlotMappings . put ( task . getExecutionId ( ) , new TaskSlotMapping ( task , taskSlot ) ) ; return true ; } else { return false ; } } else { throw new SlotNotActiveException ( task . getJobID ( ) , task . getAllocationId ( ) ) ; } } else { throw new SlotNotFoundException ( task . getAllocationId ( ) ) ; } }
Add the given task to the slot identified by the task s allocation id .