@SuppressWarnings("unchecked")
    public static <T> ClickHouseDeferredValue<T> of(CompletableFuture<T> future, long timeout) {
        final CompletableFuture<T> f = future != null ? future : (CompletableFuture<T>) ClickHouseUtils.NULL_FUTURE;
        final long t = timeout < 0L ? 0L : timeout;

        final Supplier<T> supplier = () -> {
            try {
                return t > 0L ? f.get(t, TimeUnit.MILLISECONDS) : f.get();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                f.cancel(false);
                throw new CompletionException(e);
            } catch (CancellationException e) {
                f.cancel(true);
                throw new CompletionException(e);
            } catch (ExecutionException | TimeoutException e) {
                throw new CompletionException(e);
            }
        };
        return new ClickHouseDeferredValue<>(supplier, null);
    }
Wraps a future object.

@param <T>     type of the value
@param future  future object, could be null
@param timeout timeout in milliseconds, zero or negative number means no
               timeout
@return deferred vaue of a future object
clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseDeferredValue.java