/** Unboxes {@code obj}. Assumes that obj is not {@code null} or a {@link SetFuture}. */ private V getDoneValue(Object obj) throws ExecutionException { // While this seems like it might be too branch-y, simple benchmarking proves it to be // unmeasurable (comparing done AbstractFutures with immediateFuture) if (obj instanceof Cancellation) { throw cancellationExceptionWithCause("Task was cancelled.", ((Cancellation) obj).cause); } else if (obj instanceof Failure) { throw new ExecutionException(((Failure) obj).exception); } else if (obj == NULL) { return null; } else { @SuppressWarnings("unchecked") // this is the only other option V asV = (V) obj; return asV; } }
/** Unboxes {@code obj}. Assumes that obj is not {@code null} or a {@link SetFuture}. */ private V getDoneValue(Object obj) throws ExecutionException { // While this seems like it might be too branch-y, simple benchmarking proves it to be // unmeasurable (comparing done AbstractFutures with immediateFuture) if (obj instanceof Cancellation) { throw cancellationExceptionWithCause("Task was cancelled.", ((Cancellation) obj).cause); } else if (obj instanceof Failure) { throw new ExecutionException(((Failure) obj).exception); } else if (obj == NULL) { return null; } else { @SuppressWarnings("unchecked") // this is the only other option V asV = (V) obj; return asV; } }
/** Unboxes {@code obj}. Assumes that obj is not {@code null} or a {@link SetFuture}. */ private V getDoneValue(Object obj) throws ExecutionException { // While this seems like it might be too branch-y, simple benchmarking proves it to be // unmeasurable (comparing done AbstractFutures with immediateFuture) if (obj instanceof Cancellation) { throw cancellationExceptionWithCause("Task was cancelled.", ((Cancellation) obj).cause); } else if (obj instanceof Failure) { throw new ExecutionException(((Failure) obj).exception); } else if (obj == NULL) { return null; } else { @SuppressWarnings("unchecked") // this is the only other option V asV = (V) obj; return asV; } }
@Override public V get() { throw AbstractFuture.cancellationExceptionWithCause( "Task was cancelled.", thrown); } }
@Override public V get() { throw AbstractFuture.cancellationExceptionWithCause( "Task was cancelled.", thrown); } }
@Override public V get() { throw AbstractFuture.cancellationExceptionWithCause( "Task was cancelled.", thrown); } }
@Override public V get() { throw AbstractFuture.cancellationExceptionWithCause( "Task was cancelled.", thrown); } }
@Override public V get() { throw AbstractFuture.cancellationExceptionWithCause( "Task was cancelled.", thrown); } }
@Override public V get() { throw AbstractFuture.cancellationExceptionWithCause( "Task was cancelled.", thrown); } }
@Override public V get() { throw AbstractFuture.cancellationExceptionWithCause( "Task was cancelled.", thrown); } }
@Override public V get() { throw AbstractFuture.cancellationExceptionWithCause( "Task was cancelled.", thrown); } }
/** Unboxes {@code obj}. Assumes that obj is not {@code null} or a {@link SetFuture}. */ private V getDoneValue(Object obj) throws ExecutionException { // While this seems like it might be too branch-y, simple benchmarking proves it to be // unmeasurable (comparing done AbstractFutures with immediateFuture) if (obj instanceof Cancellation) { throw cancellationExceptionWithCause("Task was cancelled.", ((Cancellation) obj).cause); } else if (obj instanceof Failure) { throw new ExecutionException(((Failure) obj).exception); } else if (obj == NULL) { return null; } else { @SuppressWarnings("unchecked") // this is the only other option V asV = (V) obj; return asV; } }
/** Unboxes {@code obj}. Assumes that obj is not {@code null} or a {@link SetFuture}. */ private V getDoneValue(Object obj) throws ExecutionException { // While this seems like it might be too branch-y, simple benchmarking proves it to be // unmeasurable (comparing done AbstractFutures with immediateFuture) if (obj instanceof Cancellation) { throw cancellationExceptionWithCause("Task was cancelled.", ((Cancellation) obj).cause); } else if (obj instanceof Failure) { throw new ExecutionException(((Failure) obj).exception); } else if (obj == NULL) { return null; } else { @SuppressWarnings("unchecked") // this is the only other option V asV = (V) obj; return asV; } }
/** * Unboxes {@code obj}. Assumes that obj is not {@code null} or a {@link SetFuture}. */ private V getDoneValue(Object obj) throws ExecutionException { // While this seems like it might be too branch-y, simple benchmarking proves it to be // unmeasurable (comparing done AbstractFutures with immediateFuture) if (obj instanceof Cancellation) { throw cancellationExceptionWithCause("Task was cancelled.", ((Cancellation) obj).cause); } else if (obj instanceof Failure) { throw new ExecutionException(((Failure) obj).exception); } else if (obj == NULL) { return null; } else { @SuppressWarnings("unchecked") // this is the only other option V asV = (V) obj; return asV; } }
/** * Implementation of the actual value retrieval. Will return the value * on success, an exception on failure, a cancellation on cancellation, or * an illegal state if the synchronizer is in an invalid state. */ private V getValue() throws CancellationException, ExecutionException { int state = getState(); switch (state) { case COMPLETED: if (exception != null) { throw new ExecutionException(exception); } else { return value; } case CANCELLED: case INTERRUPTED: throw cancellationExceptionWithCause( "Task was cancelled.", exception); default: throw new IllegalStateException( "Error, synchronizer in invalid state: " + state); } }
/** * Implementation of the actual value retrieval. Will return the value * on success, an exception on failure, a cancellation on cancellation, or * an illegal state if the synchronizer is in an invalid state. */ private V getValue() throws CancellationException, ExecutionException { int state = getState(); switch (state) { case COMPLETED: if (exception != null) { throw new ExecutionException(exception); } else { return value; } case CANCELLED: case INTERRUPTED: throw cancellationExceptionWithCause( "Task was cancelled.", exception); default: throw new IllegalStateException( "Error, synchronizer in invalid state: " + state); } }
/** * Implementation of the actual value retrieval. Will return the value * on success, an exception on failure, a cancellation on cancellation, or * an illegal state if the synchronizer is in an invalid state. */ private V getValue() throws CancellationException, ExecutionException { int state = getState(); switch (state) { case COMPLETED: if (exception != null) { throw new ExecutionException(exception); } else { return value; } case CANCELLED: case INTERRUPTED: throw cancellationExceptionWithCause( "Task was cancelled.", exception); default: throw new IllegalStateException( "Error, synchronizer in invalid state: " + state); } }
/** * Implementation of the actual value retrieval. Will return the value * on success, an exception on failure, a cancellation on cancellation, or * an illegal state if the synchronizer is in an invalid state. */ private V getValue() throws CancellationException, ExecutionException { int state = getState(); switch (state) { case COMPLETED: if (exception != null) { throw new ExecutionException(exception); } else { return value; } case CANCELLED: case INTERRUPTED: throw cancellationExceptionWithCause( "Task was cancelled.", exception); default: throw new IllegalStateException( "Error, synchronizer in invalid state: " + state); } }
/** * Implementation of the actual value retrieval. Will return the value * on success, an exception on failure, a cancellation on cancellation, or * an illegal state if the synchronizer is in an invalid state. */ private V getValue() throws CancellationException, ExecutionException { int state = getState(); switch (state) { case COMPLETED: if (exception != null) { throw new ExecutionException(exception); } else { return value; } case CANCELLED: case INTERRUPTED: throw cancellationExceptionWithCause( "Task was cancelled.", exception); default: throw new IllegalStateException( "Error, synchronizer in invalid state: " + state); } }
/** * Implementation of the actual value retrieval. Will return the value * on success, an exception on failure, a cancellation on cancellation, or * an illegal state if the synchronizer is in an invalid state. */ private V getValue() throws CancellationException, ExecutionException { int state = getState(); switch (state) { case COMPLETED: if (exception != null) { throw new ExecutionException(exception); } else { return value; } case CANCELLED: case INTERRUPTED: throw cancellationExceptionWithCause( "Task was cancelled.", exception); default: throw new IllegalStateException( "Error, synchronizer in invalid state: " + state); } }