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 class
ConnectionEvent.Type
The connection event type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Throwable
getCause()
Gets the cause of the disconnection or reconnection failure.Duration
getNextReconnectionAttempt()
Gets the duration until the next reconnection is attempted.ConnectionEvent.Type
getType()
Gets the event type.String
toString()
-
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_SUCCEEDED
type.- 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.ZERO
is 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:
toString
in classEventObject
-
-