public final class SendTask<S extends Stanza>
extends java.lang.Object
implements java.util.concurrent.Future<java.lang.Void>
A send task is the result of a send action and allows to keep track of the sent stanza.
This class implements Future
, which Future.isDone() is done}, when the stanza has been sent to the server.
XmppSession.sendMessage(Message)
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
java.lang.Void |
get() |
java.lang.Void |
get(long timeout,
java.util.concurrent.TimeUnit timeUnit) |
S |
getStanza()
Gets the stanza, which has been sent.
|
boolean |
isCancelled() |
boolean |
isDone() |
void |
onAcknowledge(java.util.function.Consumer<S> onAcknowledge)
Called when the sent stanza has been acknowledged by the server.
|
void |
onFailed(java.util.function.BiConsumer<java.lang.Throwable,S> onFailure)
Called, when a send operation failed.
|
void |
onSent(java.util.function.Consumer<S> onSent)
Called, when a stanza has been sent to the server.
|
public final S getStanza()
Gets the stanza, which has been sent.
public final void onAcknowledge(java.util.function.Consumer<S> onAcknowledge)
Called when the sent stanza has been acknowledged by the server.
onAcknowledge
- The consumer.public final void onSent(java.util.function.Consumer<S> onSent)
Called, when a stanza has been sent to the server. Note, that this does not mean, that the server received it.
onSent
- The callback.public final void onFailed(java.util.function.BiConsumer<java.lang.Throwable,S> onFailure)
Called, when a send operation failed.
onFailure
- The callback.public final boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<java.lang.Void>
public final boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<java.lang.Void>
public final boolean isDone()
isDone
in interface java.util.concurrent.Future<java.lang.Void>
public final java.lang.Void get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<java.lang.Void>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public final java.lang.Void get(long timeout, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<java.lang.Void>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
Copyright © 2014–2019 XMPP.rocks. All rights reserved.