private void handleFreeSlot ( TaskManagerSlot freeSlot ) { Preconditions . checkState ( freeSlot . getState ( ) == TaskManagerSlot . State . FREE ) ; PendingSlotRequest pendingSlotRequest = findMatchingRequest ( freeSlot . getResourceProfile ( ) ) ; if ( null != pendingSlotRequest ) { allocateSlot ( freeSlot , pendingSlotRequest ) ; } else { freeSlots . put ( freeSlot . getSlotId ( ) , freeSlot ) ; } }
Handles a free slot . It first tries to find a pending slot request which can be fulfilled . If there is no such request then it will add the slot to the set of free slots .