Package rocks.xmpp.core.session
Class ConnectionEvent
- java.lang.Object
-
- java.util.EventObject
-
- rocks.xmpp.core.session.ConnectionEvent
-
- All Implemented Interfaces:
Serializable
public final class ConnectionEvent extends EventObject
This event is fired for the following use cases:- When the XMPP session's underlying connection gets disconnected.
- When the automatic reconnection has successfully reconnected, i.e. re-established the previous session status.
- While the XMPP session is disconnected, a pending event is fired every second.
- When the reconnection failed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConnectionEvent.TypeThe connection event type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowablegetCause()Gets the cause of the disconnection or reconnection failure.DurationgetNextReconnectionAttempt()Gets the duration until the next reconnection is attempted.ConnectionEvent.TypegetType()Gets the event type.StringtoString()-
Methods inherited from class java.util.EventObject
getSource
-
-
-
-
Method Detail
-
getCause
public final Throwable getCause()
Gets the cause of the disconnection or reconnection failure. Returns null for theConnectionEvent.Type.RECONNECTION_SUCCEEDEDtype.- Returns:
- The cause of the disconnection or null.
-
getNextReconnectionAttempt
public final Duration getNextReconnectionAttempt()
Gets the duration until the next reconnection is attempted. This method should only be used in conjunction with the typeConnectionEvent.Type.RECONNECTION_PENDING. OtherwiseDuration.ZEROis returned.- Returns:
- The duration until the next reconnection is attempted.
-
getType
public final ConnectionEvent.Type getType()
Gets the event type.- Returns:
- The event type.
-
toString
public final String toString()
- Overrides:
toStringin classEventObject
-
-