protected void setCanceled() { if (this.cancelStateMessage == null) { // may have been set earlier in the cancel process this.cancelStateMessage = EMPTY_CANCEL_STATE_MESSAGE; } setDone(null); }
@Override protected boolean setDone(Throwable cause) { if (super.setDone(cause)) { delegateFuture = null; return true; } else { return false; } }
protected void setCanceled() { if (this.cancelStateMessage == null) { // may have been set earlier in the cancel process this.cancelStateMessage = EMPTY_CANCEL_STATE_MESSAGE; } setDone(null); }
@Override protected boolean setDone(Throwable cause) { if (super.setDone(cause)) { delegateFuture = null; return true; } else { return false; } }
/** * Call to indicate this future is done, and provide the given result. It is expected that only * this or {@link #setFailure(Throwable)} are called. * <p> * If future has already completed and constructed with {@link #SettableListenableFuture()} or * {@code true} provided to {@link #SettableListenableFuture(boolean)} this will throw an * {@link IllegalStateException}. If complete but constructed with a {@code false} this result * will be ignored. * * @param result result to provide for {@link #get()} call, can be {@code null} * @return {@code true} if the result was set (ie future did not complete in failure or cancel} */ public boolean setResult(T result) { synchronized (resultLock) { if (! setDone(null)) { return false; } this.result = result; } // call outside of lock listenerHelper.callListeners(); runningThread = null; return true; }
/** * Call to indicate this future is done, and provide the given result. It is expected that only * this or {@link #setFailure(Throwable)} are called. * <p> * If future has already completed and constructed with {@link #SettableListenableFuture()} or * {@code true} provided to {@link #SettableListenableFuture(boolean)} this will throw an * {@link IllegalStateException}. If complete but constructed with a {@code false} this result * will be ignored. * * @param result result to provide for {@link #get()} call, can be {@code null} * @return {@code true} if the result was set (ie future did not complete in failure or cancel} */ public boolean setResult(T result) { synchronized (resultLock) { if (! setDone(null)) { return false; } this.result = result; } // call outside of lock listenerHelper.callListeners(); runningThread = null; return true; }
if (! setDone(failure)) { // if failure is null, there is no point to have the stack twice return false;
if (! setDone(failure)) { // if failure is null, there is no point to have the stack twice return false;