Package org.igniterealtime.jbosh
Class BOSHClientConnEvent
java.lang.Object
java.util.EventObject
org.igniterealtime.jbosh.BOSHClientConnEvent
- All Implemented Interfaces:
Serializable
Client connection event, notifying of changes in connection state.
This class is immutable and thread-safe.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ThrowableCause of the session termination, ornull.private final booleanBoolean flag indicating whether or not a session has been established and is currently active.private final List<ComposableBody> List of outstanding requests which may not have been sent and/or acknowledged by the remote CM.private static final longSerialized version.Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBOSHClientConnEvent(BOSHClient source, boolean cConnected, List<ComposableBody> cRequests, Throwable cCause) Creates a new connection event instance. -
Method Summary
Modifier and TypeMethodDescription(package private) static BOSHClientConnEventCreates a new successful connection closed event.(package private) static BOSHClientConnEventcreateConnectionClosedOnErrorEvent(BOSHClient source, List<ComposableBody> outstanding, Throwable cause) Creates a connection closed on error event.(package private) static BOSHClientConnEventCreates a new connection establishment event.Gets the client from which this event originated.getCause()Returns the underlying cause of the error condition.Get the list of requests which may not have been sent or were not acknowledged by the remote connection manager prior to session termination.booleanReturns whether or not the session has been successfully established and is currently active.booleanisError()Returns whether or not this event indicates an error condition.Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialized version.- See Also:
-
connected
private final boolean connectedBoolean flag indicating whether or not a session has been established and is currently active. -
requests
List of outstanding requests which may not have been sent and/or acknowledged by the remote CM. -
cause
Cause of the session termination, ornull.
-
-
Constructor Details
-
BOSHClientConnEvent
private BOSHClientConnEvent(BOSHClient source, boolean cConnected, List<ComposableBody> cRequests, Throwable cCause) Creates a new connection event instance.- Parameters:
source- event sourcecConnected- flag indicating whether or not the session is currently activecRequests- outstanding requests when an error condition is detected, ornullwhen not an error conditioncCause- cause of the error condition, ornullwhen no error condition is present
-
-
Method Details
-
createConnectionEstablishedEvent
Creates a new connection establishment event.- Parameters:
source- client which has become connected- Returns:
- event instance
-
createConnectionClosedEvent
Creates a new successful connection closed event. This represents a clean termination of the client session.- Parameters:
source- client which has been disconnected- Returns:
- event instance
-
createConnectionClosedOnErrorEvent
static BOSHClientConnEvent createConnectionClosedOnErrorEvent(BOSHClient source, List<ComposableBody> outstanding, Throwable cause) Creates a connection closed on error event. This represents an unexpected termination of the client session.- Parameters:
source- client which has been disconnectedoutstanding- list of requests which may not have been received by the remote connection managercause- cause of termination- Returns:
- event instance
-
getBOSHClient
Gets the client from which this event originated.- Returns:
- client instance
-
isConnected
public boolean isConnected()Returns whether or not the session has been successfully established and is currently active.- Returns:
trueif a session is active,falseotherwise
-
isError
public boolean isError()Returns whether or not this event indicates an error condition. This will never returntruewhenisConnected()returnstrue.- Returns:
trueif the event indicates a terminal error has occurred,falseotherwise.
-
getCause
Returns the underlying cause of the error condition. This method is guaranteed to returnnullwhen @{code isError()} returnsfalse. Similarly, this method is guaranteed to return non-@{code null} ifisError()returnstrue.- Returns:
- underlying cause of the error condition, or
nullif this event does not represent an error condition
-
getOutstandingRequests
Get the list of requests which may not have been sent or were not acknowledged by the remote connection manager prior to session termination.- Returns:
- list of messages which may not have been received by the remote connection manager, or an empty list if the session is still connected
-