public abstract class SmackFuture<V> extends Object implements Future<V>
Modifier and Type | Class and Description |
---|---|
static class |
SmackFuture.InternalSmackFuture<V> |
static class |
SmackFuture.SimpleInternalSmackFuture<V>
A simple version of InternalSmackFuture which implements
SmackFuture.SimpleInternalSmackFuture.isNonFatalException(Exception) as always returning false method. |
Constructor and Description |
---|
SmackFuture() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
protected abstract void |
handleStanza(Stanza stanza) |
boolean |
isCancelled() |
boolean |
isDone() |
protected abstract boolean |
isNonFatalException(Exception exception)
This method checks if the given exception is not fatal.
|
protected void |
maybeInvokeCallbacks() |
void |
onError(ExceptionCallback exceptionCallback) |
void |
onSuccess(SuccessCallback<V> successCallback) |
void |
onSuccessOrError(SuccessCallback<V> successCallback,
ExceptionCallback exceptionCallback) |
protected void |
setResult(V result) |
public SmackFuture()
public final boolean cancel(boolean mayInterruptIfRunning)
public final boolean isCancelled()
isCancelled
in interface Future<V>
public void onSuccessOrError(SuccessCallback<V> successCallback, ExceptionCallback exceptionCallback)
public void onSuccess(SuccessCallback<V> successCallback)
public void onError(ExceptionCallback exceptionCallback)
public final V get() throws InterruptedException, ExecutionException
get
in interface Future<V>
InterruptedException
ExecutionException
public final V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<V>
InterruptedException
ExecutionException
TimeoutException
protected final void maybeInvokeCallbacks()
protected abstract boolean isNonFatalException(Exception exception)
false
, then
the future will automatically set the given exception as failure reason and notify potential waiting threads.exception
- the exception to check.true
if the exception is not fatal, false
otherwise.protected abstract void handleStanza(Stanza stanza) throws SmackException.NotConnectedException, InterruptedException