Class BOSHClientConnEvent

  • All Implemented Interfaces:
    java.io.Serializable

    public final class BOSHClientConnEvent
    extends java.util.EventObject
    Client connection event, notifying of changes in connection state.

    This class is immutable and thread-safe.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Throwable cause
      Cause of the session termination, or null.
      private boolean connected
      Boolean flag indicating whether or not a session has been established and is currently active.
      private java.util.List<ComposableBody> requests
      List of outstanding requests which may not have been sent and/or acknowledged by the remote CM.
      private static long serialVersionUID
      Serialized version.
      • Fields inherited from class java.util.EventObject

        source
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private BOSHClientConnEvent​(BOSHClient source, boolean cConnected, java.util.List<ComposableBody> cRequests, java.lang.Throwable cCause)
      Creates a new connection event instance.
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Serialized version.
        See Also:
        Constant Field Values
      • connected

        private final boolean connected
        Boolean flag indicating whether or not a session has been established and is currently active.
      • requests

        private final java.util.List<ComposableBody> requests
        List of outstanding requests which may not have been sent and/or acknowledged by the remote CM.
      • cause

        private final java.lang.Throwable cause
        Cause of the session termination, or null.
    • Constructor Detail

      • BOSHClientConnEvent

        private BOSHClientConnEvent​(BOSHClient source,
                                    boolean cConnected,
                                    java.util.List<ComposableBody> cRequests,
                                    java.lang.Throwable cCause)
        Creates a new connection event instance.
        Parameters:
        source - event source
        cConnected - flag indicating whether or not the session is currently active
        cRequests - outstanding requests when an error condition is detected, or null when not an error condition
        cCause - cause of the error condition, or null when no error condition is present
    • Method Detail

      • createConnectionEstablishedEvent

        static BOSHClientConnEvent createConnectionEstablishedEvent​(BOSHClient source)
        Creates a new connection establishment event.
        Parameters:
        source - client which has become connected
        Returns:
        event instance
      • createConnectionClosedEvent

        static BOSHClientConnEvent createConnectionClosedEvent​(BOSHClient source)
        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,
                                                                      java.util.List<ComposableBody> outstanding,
                                                                      java.lang.Throwable cause)
        Creates a connection closed on error event. This represents an unexpected termination of the client session.
        Parameters:
        source - client which has been disconnected
        outstanding - list of requests which may not have been received by the remote connection manager
        cause - cause of termination
        Returns:
        event instance
      • getBOSHClient

        public BOSHClient 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:
        true if a session is active, false otherwise
      • isError

        public boolean isError()
        Returns whether or not this event indicates an error condition. This will never return true when isConnected() returns true.
        Returns:
        true if the event indicates a terminal error has occurred, false otherwise.
      • getCause

        public java.lang.Throwable getCause()
        Returns the underlying cause of the error condition. This method is guaranteed to return null when @{code isError()} returns false. Similarly, this method is guaranteed to return non-@{code null} if isError() returns true.
        Returns:
        underlying cause of the error condition, or null if this event does not represent an error condition
      • getOutstandingRequests

        public java.util.List<ComposableBody> 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