code: public static <IN, OUT> CompletableFuture<OUT> thenComposeAsyncIfNotDone(
  		CompletableFuture<IN> completableFuture,
  		Executor executor,
  		Function<? super IN, ? extends CompletionStage<OUT>> composeFun) {
  		return completableFuture.isDone() ?
  			completableFuture.thenCompose(composeFun) :
  			completableFuture.thenComposeAsync(composeFun, executor);
  	}
docs: This function takes a {@link CompletableFuture} and a function to compose with this future. If the input future
  is already done, this function returns {@link CompletableFuture#thenCompose(Function)}. Otherwise, the return
  value is {@link CompletableFuture#thenComposeAsync(Function, Executor)} with the given executor.
  
  @param completableFuture the completable future for which we want to compose.
  @param executor the executor to run the compose function if the future is not yet done.
  @param composeFun the function to compose.
  @param <IN> type of the input future.
  @param <OUT> type of the output future.
  @return a completable future that is a composition of the input future and the function.