class FutureUtils {

    /**
     * Cancel execution of this future without interrupting a running thread. See {@link Future#cancel(boolean)} for details.
     *
     * @param toCancel the future to cancel
     * @return false if the future could not be cancelled, otherwise true
     */
    @SuppressForbidden(reason = "Future#cancel()")
    public static boolean cancel(@Nullable final Future<?> toCancel) {<FILL_FUNCTION_BODY>}

    /**
     * Calls {@link Future#get()} without the checked exceptions.
     *
     * @param future to dereference
     * @param <T> the type returned
     * @return the value of the future
     */
    public static <T> T get(Future<T> future) {
        try {
            return future.get();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new IllegalStateException("Future got interrupted", e);
        } catch (ExecutionException e) {
            throw rethrowExecutionException(e);
        }
    }

    /**
     * Calls {@link #get(Future, long, TimeUnit)}
     */
    public static <T> T get(Future<T> future, TimeValue timeValue) {
        return get(future, timeValue.millis(), TimeUnit.MILLISECONDS);
    }

    /**
     * Calls {@link Future#get(long, TimeUnit)} without the checked exceptions.
     *
     * @param future to dereference
     * @param timeout to wait
     * @param unit for timeout
     * @param <T> the type returned
     * @return the value of the future
     */
    public static <T> T get(Future<T> future, long timeout, TimeUnit unit) {
        try {
            return future.get(timeout, unit);
        } catch (TimeoutException e) {
            throw new ElasticsearchTimeoutException(e);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new IllegalStateException("Future got interrupted", e);
        } catch (ExecutionException e) {
            throw FutureUtils.rethrowExecutionException(e);
        }
    }

    public static RuntimeException rethrowExecutionException(ExecutionException e) {
        return Exceptions.toRuntimeException(SQLExceptions.unwrap(e));
    }
}

        if (toCancel != null) {
            return toCancel.cancel(false); // this method is a forbidden API since it interrupts threads
        }
        return false;
    
<no_super_class>