code: @Nonnull
  	private CompletableFuture<AllocatedSlot> requestNewAllocatedSlotInternal(
  		@Nonnull SlotRequestId slotRequestId,
  		@Nonnull ResourceProfile resourceProfile,
  		@Nonnull Time timeout) {
  
  		componentMainThreadExecutor.assertRunningInMainThread();
  
  		final PendingRequest pendingRequest = new PendingRequest(
  			slotRequestId,
  			resourceProfile);
  
  		// register request timeout
  		FutureUtils
  			.orTimeout(
  				pendingRequest.getAllocatedSlotFuture(),
  				timeout.toMilliseconds(),
  				TimeUnit.MILLISECONDS,
  				componentMainThreadExecutor)
  			.whenComplete(
  				(AllocatedSlot ignored, Throwable throwable) -> {
  					if (throwable instanceof TimeoutException) {
  						timeoutPendingSlotRequest(slotRequestId);
  					}
  				});
  
  		if (resourceManagerGateway == null) {
  			stashRequestWaitingForResourceManager(pendingRequest);
  		} else {
  			requestSlotFromResourceManager(resourceManagerGateway, pendingRequest);
  		}
  
  		return pendingRequest.getAllocatedSlotFuture();
  	}
docs: Requests a new slot with the given {@link ResourceProfile} from the ResourceManager. If there is
  currently not ResourceManager connected, then the request is stashed and send once a new
  ResourceManager is connected.
  
  @param slotRequestId identifying the requested slot
  @param resourceProfile which the requested slot should fulfill
  @param timeout timeout before the slot allocation times out
  @return An {@link AllocatedSlot} future which is completed once the slot is offered to the {@link SlotPool}