@ Override public void returnLogicalSlot ( LogicalSlot logicalSlot ) { checkNotNull ( logicalSlot ) ; checkArgument ( logicalSlot instanceof Slot ) ; final Slot slot = ( ( Slot ) logicalSlot ) ; checkArgument ( ! slot . isAlive ( ) , "slot is still alive" ) ; checkArgument ( slot . getOwner ( ) == this , "slot belongs to the wrong TaskManager." ) ; if ( slot . markReleased ( ) ) { LOG . debug ( "Return allocated slot {}." , slot ) ; synchronized ( instanceLock ) { if ( isDead ) { return ; } if ( this . allocatedSlots . remove ( slot ) ) { this . availableSlots . add ( slot . getSlotNumber ( ) ) ; if ( this . slotAvailabilityListener != null ) { this . slotAvailabilityListener . newSlotAvailable ( this ) ; } } else { throw new IllegalArgumentException ( "Slot was not allocated from this TaskManager." ) ; } } } }
Returns a slot that has been allocated from this instance . The slot needs have been canceled prior to calling this method .