Refine search
private T getResult() throws ExecutionException { if (this.ex != null) { throw new ExecutionException(this.ex); } if (cancelled) { throw new CancellationException(); } return this.result; }
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (latch.await(timeout, unit)) { if (error != null) { throw new ExecutionException(error); } return result; } else { throw new TimeoutException(); } }
V innerGet(long nanosTimeout) throws InterruptedException, ExecutionException, TimeoutException { if (!tryAcquireSharedNanos(0, nanosTimeout)) throw new TimeoutException(); if (getState() == CANCELLED) throw new CancellationException(); if (exception != null) throw new ExecutionException(exception); return result; }
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); if (!await(timeout, unit)) { throw new TimeoutException(timeoutMessage(timeout, unit)); } } if (isCancelled()) { throw new CancellationException(); } Throwable ex = error; if (ex != null) { throw new ExecutionException(ex); } return value; }
private synchronized T doGet(Long timeoutMs) throws InterruptedException, ExecutionException, TimeoutException { if (mException != null) { throw new ExecutionException(mException); } if (mResultReceived) { return mResult; } if (timeoutMs == null) { wait(0); } else if (timeoutMs > 0) { wait(timeoutMs); } if (mException != null) { throw new ExecutionException(mException); } if (!mResultReceived) { throw new TimeoutException(); } return mResult; }
private T getResult() throws ExecutionException { if (this.ex != null) { throw new ExecutionException(this.ex); } if (cancelled) { throw new CancellationException(); } return this.result; }
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); if (!await(timeout, unit)) { throw new TimeoutException(timeoutMessage(timeout, unit)); } } if (isCancelled()) { throw new CancellationException(); } Throwable ex = error; if (ex != null) { throw new ExecutionException(ex); } return value; }
private synchronized T doGet(Long timeoutMs) throws InterruptedException, ExecutionException, TimeoutException { if (mException != null) { throw new ExecutionException(mException); } if (mResultReceived) { return mResult; } if (timeoutMs == null) { wait(0); } else if (timeoutMs > 0) { wait(timeoutMs); } if (mException != null) { throw new ExecutionException(mException); } if (!mResultReceived) { throw new TimeoutException(); } return mResult; }
private V getOrThrowExecutionException() throws ExecutionException { assert (result != null || exception != null || cancelled); if (result != null) { return result; } if (exception != null) { throw new ExecutionException(exception); } assert (cancelled); throw new CancellationException(); }
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); if (!await(timeout, unit)) { throw new TimeoutException(timeoutMessage(timeout, unit)); } } if (isCancelled()) { throw new CancellationException(); } Throwable ex = error; if (ex != null) { throw new ExecutionException(ex); } return value; }
private synchronized T doGet(Long timeoutMs) throws InterruptedException, ExecutionException, TimeoutException { if (mException != null) { throw new ExecutionException(mException); } if (mResultReceived) { return mResult; } if (timeoutMs == null) { wait(0); } else if (timeoutMs > 0) { wait(timeoutMs); } if (mException != null) { throw new ExecutionException(mException); } if (!mResultReceived) { throw new TimeoutException(); } return mResult; }
/** * Returns result or throws exception for completed task. * * @param s completed state value */ @SuppressWarnings("unchecked") private V report(int s) throws ExecutionException { Object x = outcome; if (s == NORMAL) return (V)x; if (s >= CANCELLED) throw new CancellationException(); throw new ExecutionException((Throwable)x); }
throw new CancellationException(); } else if (loadFailed) { throw new ExecutionException(exception); } else if (resultReceived) { return resource; throw new InterruptedException(); } else if (loadFailed) { throw new ExecutionException(exception); } else if (isCancelled) { throw new CancellationException(); } else if (!resultReceived) { throw new TimeoutException();
@Override public synchronized Res get(long timeout, TimeUnit tu) throws InterruptedException, ExecutionException, TimeoutException { long waitStartMs = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS); long timeoutMs = TimeUnit.MILLISECONDS.convert(timeout, tu); long timeToWaitMs = timeoutMs; while (!done) { // if timeToWaitMs is zero, we don't call wait() at all, because wait(0) means // "wait forever", which is the opposite of what we want. if (timeToWaitMs <= 0) { throw new TimeoutException("Timed out waiting for results after " + timeout + " " + tu); } wait(timeToWaitMs); // compute how long to wait in the next loop long nowMs = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS); timeToWaitMs = timeoutMs - (nowMs - waitStartMs); } // if we got here, we are done. Throw if there's anything to throw, // otherwise return the result if (e != null) { throw new ExecutionException(e); } // may be null, e.g. for Void futures return result; }
@Override public T get() throws InterruptedException, ExecutionException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); await(); } if (isCancelled()) { throw new CancellationException(); } Throwable ex = error; if (ex != null) { throw new ExecutionException(ex); } return value; }
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); if (!await(timeout, unit)) { throw new TimeoutException(); } } if (isCancelled()) { throw new CancellationException(); } Throwable ex = error; if (ex != null) { throw new ExecutionException(ex); } return value; }
return null; } else { throw new ExecutionException(exception); throw new TimeoutException();
@Override public T get() throws InterruptedException, ExecutionException { switch (state) { case S_READY: try { result = run(); state = S_DONE; } catch (Exception e) { error = e; if (e instanceof InterruptedException) { throw (InterruptedException) e; } throw new ExecutionException(e); } finally { if (state != S_DONE) { state = S_ERROR; } } return result; case S_DONE: return result; case S_ERROR: throw new ExecutionException(error); case S_CANCELED: throw new CancellationException(); default: throw DbException.throwInternalError("" + state); } }
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (getCount() != 0) { BlockingHelper.verifyNonBlocking(); if (!await(timeout, unit)) { throw new TimeoutException(); } } if (isCancelled()) { throw new CancellationException(); } Throwable ex = error; if (ex != null) { throw new ExecutionException(ex); } return value; }
f = futureQueue.poll(timeoutNanos, TimeUnit.NANOSECONDS); if (f == null) { throw new TimeoutException(); ee = eex; } catch (RuntimeException rex) { ee = new ExecutionException(rex); ee = new ExecutionException(null);