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 classSmackFuture.InternalProcessStanzaSmackFuture<V,E extends Exception>static classSmackFuture.InternalSmackFuture<V,E extends Exception>static classSmackFuture.SimpleInternalProcessStanzaSmackFuture<V,E extends Exception>A simple version of InternalSmackFuture which implements isNonFatalException(E) as always returningfalsemethod.static classSmackFuture.SocketFuture
-
Constructor Summary
Constructors Constructor Description SmackFuture()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanawait(Collection<? extends SmackFuture<?,?>> futures, long timeout, TimeUnit unit)booleancancel(boolean mayInterruptIfRunning)static <V,E extends Exception>
SmackFuture<V,E>from(V result)protected voidfutureWait()protected voidfutureWait(long timeout)Vget()Vget(long timeout, TimeUnit unit)VgetIfAvailable()VgetOrThrow()booleanisCancelled()booleanisDone()protected voidmaybeInvokeCallbacks()voidonCompletion(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:
isCancelledin interfaceFuture<V>
-
onSuccess
public CallbackRecipient<V,E> onSuccess(SuccessCallback<V> successCallback)
- Specified by:
onSuccessin interfaceCallbackRecipient<V,E extends Exception>
-
onError
public CallbackRecipient<V,E> onError(ExceptionCallback<E> exceptionCallback)
- Specified by:
onErrorin interfaceCallbackRecipient<V,E extends Exception>
-
onCompletion
public void onCompletion(Consumer<SmackFuture<V,E>> completionCallback)
-
get
public final V get() throws InterruptedException, ExecutionException
- Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionException
-
getOrThrow
public final V getOrThrow() throws E extends Exception, InterruptedException
- Throws:
E extends ExceptionInterruptedException
-
get
public final V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
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
-
-