code: public static CompletableFuture<Void> delayedFuture(Duration delay, ScheduledExecutorService executorService) {
          CompletableFuture<Void> result = new CompletableFuture<>();
          if (delay.toMillis() == 0) {
              // Zero delay; no need to bother with scheduling a task in the future.
              result.complete(null);
          } else {
              ScheduledFuture<Boolean> sf = executorService.schedule(() -> result.complete(null), delay.toMillis(), TimeUnit.MILLISECONDS);
              result.whenComplete((r, ex) -> sf.cancel(true));
          }
  
          return result;
      }
docs: Creates a CompletableFuture that will do nothing and complete after a specified delay, without using a thread during
  the delay.
  
  @param delay           The duration of the delay (how much to wait until completing the Future).
  @param executorService An ExecutorService that will be used to complete the Future on.
  @return A CompletableFuture that will complete after the specified delay.