public class SynchronizationPoint<E extends java.lang.Exception>
extends java.lang.Object
| Constructor and Description |
|---|
SynchronizationPoint(AbstractXMPPConnection connection,
java.lang.String waitFor)
Construct a new synchronization point for the given connection.
|
| Modifier and Type | Method and Description |
|---|---|
E |
checkIfSuccessOrWait()
Check if this synchronization point is successful or wait the connections reply timeout.
|
void |
checkIfSuccessOrWaitOrThrow()
Check if this synchronization point is successful or wait the connections reply timeout.
|
void |
init()
Initialize (or reset) this synchronization point.
|
void |
reportFailure()
Deprecated.
use
reportFailure(Exception) instead. |
void |
reportFailure(E failureException)
Report this synchronization point as failed because of the given exception.
|
void |
reportSuccess()
Report this synchronization point as successful.
|
boolean |
requestSent()
Check if this synchronization point has its request already sent.
|
E |
sendAndWaitForResponse(TopLevelStreamElement request)
Send the given top level stream element and wait for a response.
|
void |
sendAndWaitForResponseOrThrow(Nonza request)
Send the given plain stream element and wait for a response.
|
boolean |
wasSuccessful()
Check if this synchronization point was successful.
|
public SynchronizationPoint(AbstractXMPPConnection connection, java.lang.String waitFor)
connection - the connection of this synchronization point.waitFor - a description of the event this synchronization point handles.public void init()
public E sendAndWaitForResponse(TopLevelStreamElement request) throws SmackException.NoResponseException, SmackException.NotConnectedException, java.lang.InterruptedException
request - the plain stream element to send.null if synchronization point was successful, or the failure Exception.SmackException.NoResponseException - if no response was received.SmackException.NotConnectedException - if the connection is not connected.java.lang.InterruptedExceptionpublic void sendAndWaitForResponseOrThrow(Nonza request) throws E extends java.lang.Exception, SmackException.NoResponseException, SmackException.NotConnectedException, java.lang.InterruptedException
request - the plain stream element to send.E - if an failure was reported.SmackException.NoResponseException - if no response was received.SmackException.NotConnectedException - if the connection is not connected.E extends java.lang.Exceptionjava.lang.InterruptedExceptionpublic void checkIfSuccessOrWaitOrThrow()
throws SmackException.NoResponseException,
E extends java.lang.Exception,
java.lang.InterruptedException
SmackException.NoResponseException - if there was no response marking the synchronization point as success or failed.E - if there was a failurejava.lang.InterruptedExceptionE extends java.lang.Exceptionpublic E checkIfSuccessOrWait() throws SmackException.NoResponseException, java.lang.InterruptedException
null if synchronization point was successful, or the failure Exception.SmackException.NoResponseException - if there was no response marking the synchronization point as success or failed.java.lang.InterruptedExceptionpublic void reportSuccess()
@Deprecated public void reportFailure()
reportFailure(Exception) instead.public void reportFailure(E failureException)
failureException must be set.failureException - the exception causing this synchronization point to fail.public boolean wasSuccessful()
public boolean requestSent()