Code example for ExecutionException

0
        return this.completed;
    } 
 
    private T getResult() throws ExecutionException { 
        if (this.ex != null) {
            throw new ExecutionException(this.ex);
        } 
        return this.result;
    } 
 
    public synchronized T get() throws InterruptedException, ExecutionException { 
        while (!this.completed) {
            wait();
        } 
        return getResult(); 
    } 
 
    public synchronized T get(final long timeout, final TimeUnit unit)
            throws InterruptedException, ExecutionException, TimeoutException { 
        Args.notNull(unit, "Time unit");
        final long msecs = unit.toMillis(timeout);