code: public static <V> ListenableFuture<V> toListenableFuture(CompletableFuture<V> completableFuture)
      {
          requireNonNull(completableFuture, "completableFuture is null");
          SettableFuture<V> future = SettableFuture.create();
          propagateCancellation(future, completableFuture, true);
  
          completableFuture.whenComplete((value, exception) -> {
              if (exception != null) {
                  future.setException(exception);
              }
              else {
                  future.set(value);
              }
          });
          return future;
      }
docs: Converts a CompletableFuture to a ListenableFuture. Cancellation of the
  ListenableFuture will be propagated to the CompletableFuture.