Package org.jivesoftware.smack
Class SmackFuture<V,E extends java.lang.Exception>
- java.lang.Object
-
- org.jivesoftware.smack.SmackFuture<V,E>
-
- All Implemented Interfaces:
java.util.concurrent.Future<V>
,CallbackRecipient<V,E>
- Direct Known Subclasses:
SmackFuture.InternalSmackFuture
public abstract class SmackFuture<V,E extends java.lang.Exception> extends java.lang.Object implements java.util.concurrent.Future<V>, CallbackRecipient<V,E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SmackFuture.InternalProcessStanzaSmackFuture<V,E extends java.lang.Exception>
static class
SmackFuture.InternalSmackFuture<V,E extends java.lang.Exception>
static class
SmackFuture.SimpleInternalProcessStanzaSmackFuture<V,E extends java.lang.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(java.util.Collection<? extends SmackFuture<?,?>> futures, long timeout, java.util.concurrent.TimeUnit unit)
boolean
cancel(boolean mayInterruptIfRunning)
static <V,E extends java.lang.Exception>
SmackFuture<V,E>from(V result)
protected void
futureWait()
protected void
futureWait(long timeout)
V
get()
V
get(long timeout, java.util.concurrent.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)
- Specified by:
cancel
in interfacejava.util.concurrent.Future<V>
-
isCancelled
public final boolean isCancelled()
- Specified by:
isCancelled
in interfacejava.util.concurrent.Future<V>
-
isDone
public final boolean isDone()
- Specified by:
isDone
in interfacejava.util.concurrent.Future<V>
-
onSuccess
public CallbackRecipient<V,E> onSuccess(SuccessCallback<V> successCallback)
- Specified by:
onSuccess
in interfaceCallbackRecipient<V,E extends java.lang.Exception>
-
onError
public CallbackRecipient<V,E> onError(ExceptionCallback<E> exceptionCallback)
- Specified by:
onError
in interfaceCallbackRecipient<V,E extends java.lang.Exception>
-
onCompletion
public void onCompletion(Consumer<SmackFuture<V,E>> completionCallback)
-
get
public final V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
get
in interfacejava.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
getOrThrow
public final V getOrThrow() throws E extends java.lang.Exception, java.lang.InterruptedException
- Throws:
E extends java.lang.Exception
java.lang.InterruptedException
-
get
public final V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
- Specified by:
get
in interfacejava.util.concurrent.Future<V>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
-
getIfAvailable
public V getIfAvailable()
-
maybeInvokeCallbacks
protected final void maybeInvokeCallbacks()
-
futureWait
protected final void futureWait() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
futureWait
protected void futureWait(long timeout) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
from
public static <V,E extends java.lang.Exception> SmackFuture<V,E> from(V result)
-
await
public static boolean await(java.util.Collection<? extends SmackFuture<?,?>> futures, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
-