public class SynchronizationPoint<E extends Exception> extends Object
Constructor and Description |
---|
SynchronizationPoint(AbstractXMPPConnection connection,
String waitFor)
Construct a new synchronization point for the given connection.
|
Modifier and Type | Method and Description |
---|---|
Exception |
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.
|
E |
getFailureException() |
void |
init()
Initialize (or reset) this synchronization point.
|
boolean |
isNotInInitialState() |
void |
reportFailure()
Deprecated.
use
reportFailure(Exception) instead. |
void |
reportFailure(E failureException)
Report this synchronization point as failed because of the given exception.
|
void |
reportGenericFailure(SmackException.SmackWrappedException exception)
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.
|
Exception |
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, String waitFor)
connection
- the connection of this synchronization point.waitFor
- a description of the event this synchronization point handles.public void init()
public Exception sendAndWaitForResponse(TopLevelStreamElement request) throws SmackException.NoResponseException, SmackException.NotConnectedException, 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.InterruptedException
- if the connection is interrupted.public void sendAndWaitForResponseOrThrow(Nonza request) throws E extends Exception, SmackException.NoResponseException, SmackException.NotConnectedException, InterruptedException, SmackException.SmackWrappedException
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.InterruptedException
- if the connection is interrupted.SmackException.SmackWrappedException
- in case of a wrapped exception;E extends Exception
public void checkIfSuccessOrWaitOrThrow() throws SmackException.NoResponseException, E extends Exception, InterruptedException, SmackException.SmackWrappedException
SmackException.NoResponseException
- if there was no response marking the synchronization point as success or failed.E
- if there was a failureInterruptedException
- if the connection is interrupted.SmackException.SmackWrappedException
- in case of a wrapped exception;E extends Exception
public Exception checkIfSuccessOrWait() throws SmackException.NoResponseException, 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.InterruptedException
public 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 void reportGenericFailure(SmackException.SmackWrappedException exception)
failureException
must be set.exception
- the exception causing this synchronization point to fail.public boolean wasSuccessful()
public boolean isNotInInitialState()
public boolean requestSent()
public E getFailureException()