/** * Sets the failed result of this {@code Future} unless this {@code Future} has already been * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the * {@code Future} may have previously been set asynchronously, in which case its result may not be * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param throwable the exception to be used as the failed result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean setException(Throwable throwable) { Object valueToSet = new Failure(checkNotNull(throwable)); if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
/** * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns, * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code * Future} may have previously been set asynchronously, in which case its result may not be known * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param value the value to be used as the result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean set(@Nullable V value) { Object valueToSet = value == null ? NULL : value; if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
/** * Sets the failed result of this {@code Future} unless this {@code Future} has already been * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the * {@code Future} may have previously been set asynchronously, in which case its result may not be * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param throwable the exception to be used as the failed result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean setException(Throwable throwable) { Object valueToSet = new Failure(checkNotNull(throwable)); if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
abstractFuture.interruptTask(); complete(abstractFuture); if (localValue instanceof SetFuture) {
/** * Sets the failed result of this {@code Future} unless this {@code Future} has already been * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the * {@code Future} may have previously been set asynchronously, in which case its result may not be * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param throwable the exception to be used as the failed result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean setException(Throwable throwable) { Object valueToSet = new Failure(checkNotNull(throwable)); if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
/** * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns, * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code * Future} may have previously been set asynchronously, in which case its result may not be known * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param value the value to be used as the result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean set(@NullableDecl V value) { Object valueToSet = value == null ? NULL : value; if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
/** * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns, * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code * Future} may have previously been set asynchronously, in which case its result may not be known * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param value the value to be used as the result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean set(@NullableDecl V value) { Object valueToSet = value == null ? NULL : value; if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
abstractFuture.interruptTask(); complete(abstractFuture); if (localValue instanceof SetFuture) {
Object value = getFutureValue(future); if (ATOMIC_HELPER.casValue(this, null, value)) { complete(this); return true;
abstractFuture.interruptTask(); complete(abstractFuture); if (localValue instanceof SetFuture) {
Object value = getFutureValue(future); if (ATOMIC_HELPER.casValue(this, null, value)) { complete(this); return true;
Object value = getFutureValue(future); if (ATOMIC_HELPER.casValue(this, null, value)) { complete(this); return true;
/** * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns, * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code * Future} may have previously been set asynchronously, in which case its result may not be known * yet. That result, though not yet known, cannot by overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param value the value to be used as the result * @return true if the attempt was accepted, completing the {@code Future} */ protected boolean set(@Nullable V value) { Object valueToSet = value == null ? NULL : value; if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(); return true; } return false; }
/** * Sets the failed result of this {@code Future} unless this {@code Future} has already been * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the * {@code Future} may have previously been set asynchronously, in which case its result may not be * known yet. That result, though not yet known, cannot by overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param throwable the exception to be used as the failed result * @return true if the attempt was accepted, completing the {@code Future} */ protected boolean setException(Throwable throwable) { Object valueToSet = new Failure(checkNotNull(throwable)); if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(); return true; } return false; }
/** * Sets the failed result of this {@code Future} unless this {@code Future} has already been * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the * {@code Future} may have previously been set asynchronously, in which case its result may not be * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param throwable the exception to be used as the failed result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean setException(Throwable throwable) { Object valueToSet = new Failure(checkNotNull(throwable)); if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
/** * Sets the failed result of this {@code Future} unless this {@code Future} has already been * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the * {@code Future} may have previously been set asynchronously, in which case its result may not be * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param throwable the exception to be used as the failed result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean setException(Throwable throwable) { Object valueToSet = new Failure(checkNotNull(throwable)); if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
/** * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns, * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code * Future} may have previously been set asynchronously, in which case its result may not be known * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param value the value to be used as the result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean set(@NullableDecl V value) { Object valueToSet = value == null ? NULL : value; if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
/** * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns, * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code * Future} may have previously been set asynchronously, in which case its result may not be known * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*} * method, only by a call to {@link #cancel}. * * @param value the value to be used as the result * @return true if the attempt was accepted, completing the {@code Future} */ @CanIgnoreReturnValue protected boolean set(@Nullable V value) { Object valueToSet = value == null ? NULL : value; if (ATOMIC_HELPER.casValue(this, null, valueToSet)) { complete(this); return true; } return false; }
complete(); return true;
interruptTask(); complete(); if (localValue instanceof AbstractFuture.SetFuture) {