@Override public final synchronized V get() throws InterruptedException, ExecutionException { while (result == null && exception == null && !cancelled) { futureWait(); } return getOrThrowExecutionException(); }
@Override public final synchronized boolean cancel(boolean mayInterruptIfRunning) { if (isDone()) { return false; } cancelled = true; if (mayInterruptIfRunning) { notifyAll(); } return true; }
@Override public CallbackRecipient<V, E> onSuccess(SuccessCallback<V> successCallback) { this.successCallback = successCallback; maybeInvokeCallbacks(); return this; }
private void sendUseCarbons(final boolean use, ExceptionCallback<Exception> exceptionCallback) { IQ setIQ = carbonsEnabledIQ(use); SmackFuture<IQ, Exception> future = connection().sendIqRequestAsync(setIQ); future.onSuccess(new SuccessCallback<IQ>() { @Override public void onSuccess(IQ result) { enabled_state = use; } }).onError(exceptionCallback); }
@Override public final synchronized V get() throws InterruptedException, ExecutionException { while (result == null && exception == null && !cancelled) { wait(); } return getOrThrowExecutionException(); }
protected final void futureWait() throws InterruptedException { futureWait(0); }
.onSuccess(new SuccessCallback<IQ>() { @Override public void onSuccess(IQ result) {
@Override public final synchronized V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { final long deadline = System.currentTimeMillis() + unit.toMillis(timeout); while (result != null && exception != null) { final long waitTimeRemaining = deadline - System.currentTimeMillis(); if (waitTimeRemaining > 0) { wait(waitTimeRemaining); } } if (cancelled) { throw new CancellationException(); } if (result == null || exception == null) { throw new TimeoutException(); } return getOrThrowExecutionException(); }
public final synchronized V getOrThrow() throws E, InterruptedException { while (result == null && exception == null && !cancelled) { futureWait(); } if (exception != null) { throw exception; } if (cancelled) { throw new CancellationException(); } assert result != null; return result; }
future.onSuccess(new RosterResultListener()).onError(new ExceptionCallback<Exception>() {
@Override public final synchronized V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { final long deadline = System.currentTimeMillis() + unit.toMillis(timeout); while (result != null && exception != null) { final long waitTimeRemaining = deadline - System.currentTimeMillis(); if (waitTimeRemaining > 0) { futureWait(waitTimeRemaining); } } if (cancelled) { throw new CancellationException(); } if (result == null || exception == null) { throw new TimeoutException(); } return getOrThrowExecutionException(); }
@Override public CallbackRecipient<V, E> onError(ExceptionCallback<E> exceptionCallback) { this.exceptionCallback = exceptionCallback; maybeInvokeCallbacks(); return this; }
@Override public final synchronized boolean cancel(boolean mayInterruptIfRunning) { if (isDone()) { return false; } cancelled = true; if (mayInterruptIfRunning) { notifyAll(); } return true; }
private void sendUseCarbons(final boolean use, ExceptionCallback<Exception> exceptionCallback) { IQ setIQ = carbonsEnabledIQ(use); SmackFuture<IQ, Exception> future = connection().sendIqRequestAsync(setIQ); future.onSuccess(new SuccessCallback<IQ>() { @Override public void onSuccess(IQ result) { enabled_state = use; } }).onError(exceptionCallback); }
@Override public CallbackRecipient<V, E> onSuccess(SuccessCallback<V> successCallback) { this.successCallback = successCallback; maybeInvokeCallbacks(); return this; }
future.onSuccess(new RosterResultListener()).onError(new ExceptionCallback<Exception>() {
@Override public CallbackRecipient<V, E> onError(ExceptionCallback<E> exceptionCallback) { this.exceptionCallback = exceptionCallback; maybeInvokeCallbacks(); return this; }