code: private void registerSlot(
  			SlotID slotId,
  			AllocationID allocationId,
  			JobID jobId,
  			ResourceProfile resourceProfile,
  			TaskExecutorConnection taskManagerConnection) {
  
  		if (slots.containsKey(slotId)) {
  			// remove the old slot first
  			removeSlot(slotId);
  		}
  
  		final TaskManagerSlot slot = createAndRegisterTaskManagerSlot(slotId, resourceProfile, taskManagerConnection);
  
  		final PendingTaskManagerSlot pendingTaskManagerSlot;
  
  		if (allocationId == null) {
  			pendingTaskManagerSlot = findExactlyMatchingPendingTaskManagerSlot(resourceProfile);
  		} else {
  			pendingTaskManagerSlot = null;
  		}
  
  		if (pendingTaskManagerSlot == null) {
  			updateSlot(slotId, allocationId, jobId);
  		} else {
  			pendingSlots.remove(pendingTaskManagerSlot.getTaskManagerSlotId());
  			final PendingSlotRequest assignedPendingSlotRequest = pendingTaskManagerSlot.getAssignedPendingSlotRequest();
  
  			if (assignedPendingSlotRequest == null) {
  				handleFreeSlot(slot);
  			} else {
  				assignedPendingSlotRequest.unassignPendingTaskManagerSlot();
  				allocateSlot(slot, assignedPendingSlotRequest);
  			}
  		}
  	}
docs: Registers a slot for the given task manager at the slot manager. The slot is identified by
  the given slot id. The given resource profile defines the available resources for the slot.
  The task manager connection can be used to communicate with the task manager.
  
  @param slotId identifying the slot on the task manager
  @param allocationId which is currently deployed in the slot
  @param resourceProfile of the slot
  @param taskManagerConnection to communicate with the remote task manager