public T get()

in src/main/java/com/twitter/whiskey/futures/CompletableFuture.java [133:154]


    public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {

        if (!done) {
            synchronized(this) {
                if (!done) wait(unit.toMillis(timeout));
            }
        }

        if (!done) {
            throw new TimeoutException();
        }

        if (error != null) {
            throw new ExecutionException(error);
        }

        if (cancelled) {
            throw new CancellationException();
        }

        return result;
    }