Package org.jivesoftware.smack
Class SmackFuture<V,E extends Exception>
- java.lang.Object
-
- org.jivesoftware.smack.SmackFuture<V,E>
-
- All Implemented Interfaces:
Future<V>
,CallbackRecipient<V,E>
- Direct Known Subclasses:
SmackFuture.InternalSmackFuture
public abstract class SmackFuture<V,E extends Exception> extends Object implements Future<V>, CallbackRecipient<V,E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SmackFuture.InternalProcessStanzaSmackFuture<V,E extends Exception>
static class
SmackFuture.InternalSmackFuture<V,E extends Exception>
static class
SmackFuture.SimpleInternalProcessStanzaSmackFuture<V,E extends Exception>
A simple version of InternalSmackFuture which implements isNonFatalException(E) as always returningfalse
method.static class
SmackFuture.SocketFuture
-
Constructor Summary
Constructors Constructor Description SmackFuture()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
await(Collection<? extends SmackFuture<?,?>> futures, long timeout, TimeUnit unit)
boolean
cancel(boolean mayInterruptIfRunning)
static <V,E extends Exception>
SmackFuture<V,E>from(V result)
protected void
futureWait()
protected void
futureWait(long timeout)
V
get()
V
get(long timeout, TimeUnit unit)
V
getIfAvailable()
V
getOrThrow()
boolean
isCancelled()
boolean
isDone()
protected void
maybeInvokeCallbacks()
void
onCompletion(Consumer<SmackFuture<V,E>> completionCallback)
CallbackRecipient<V,E>
onError(ExceptionCallback<E> exceptionCallback)
CallbackRecipient<V,E>
onSuccess(SuccessCallback<V> successCallback)
-
-
-
Constructor Detail
-
SmackFuture
public SmackFuture()
-
-
Method Detail
-
cancel
public final boolean cancel(boolean mayInterruptIfRunning)
-
isCancelled
public final boolean isCancelled()
- Specified by:
isCancelled
in interfaceFuture<V>
-
onSuccess
public CallbackRecipient<V,E> onSuccess(SuccessCallback<V> successCallback)
- Specified by:
onSuccess
in interfaceCallbackRecipient<V,E extends Exception>
-
onError
public CallbackRecipient<V,E> onError(ExceptionCallback<E> exceptionCallback)
- Specified by:
onError
in interfaceCallbackRecipient<V,E extends Exception>
-
onCompletion
public void onCompletion(Consumer<SmackFuture<V,E>> completionCallback)
-
get
public final V get() throws InterruptedException, ExecutionException
- Specified by:
get
in interfaceFuture<V>
- Throws:
InterruptedException
ExecutionException
-
getOrThrow
public final V getOrThrow() throws E extends Exception, InterruptedException
- Throws:
E extends Exception
InterruptedException
-
get
public final V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- Specified by:
get
in interfaceFuture<V>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
getIfAvailable
public V getIfAvailable()
-
maybeInvokeCallbacks
protected final void maybeInvokeCallbacks()
-
futureWait
protected final void futureWait() throws InterruptedException
- Throws:
InterruptedException
-
futureWait
protected void futureWait(long timeout) throws InterruptedException
- Throws:
InterruptedException
-
from
public static <V,E extends Exception> SmackFuture<V,E> from(V result)
-
await
public static boolean await(Collection<? extends SmackFuture<?,?>> futures, long timeout, TimeUnit unit) throws InterruptedException
- Throws:
InterruptedException
-
-