public abstract class SmackFuture<V> extends java.lang.Object implements java.util.concurrent.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. |
Modifier and Type | Field and Description |
---|---|
protected java.lang.Exception |
exception |
Constructor and Description |
---|
SmackFuture() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
V |
get() |
V |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
protected abstract void |
handleStanza(Stanza stanza) |
boolean |
isCancelled() |
boolean |
isDone() |
protected abstract boolean |
isNonFatalException(java.lang.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) |
protected java.lang.Exception exception
public SmackFuture()
public final boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<V>
public final boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<V>
public final boolean isDone()
isDone
in interface java.util.concurrent.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 java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<V>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public final V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<V>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
protected final void maybeInvokeCallbacks()
protected abstract boolean isNonFatalException(java.lang.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, java.lang.InterruptedException
SmackException.NotConnectedException
java.lang.InterruptedException