Mercury-IM/core-old/src/main/java/org/mercury_im/messenger/core/connection/ConnectionState.java

49 lines
1.2 KiB
Java
Raw Normal View History

2019-08-25 17:54:03 +02:00
package org.mercury_im.messenger.core.connection;
2019-05-27 21:34:11 +02:00
/**
* {@link MercuryConnection} modeled as a finite state machine.
* Below enums represent the states of the machine.
*/
public enum ConnectionState {
/**
* Connection is disconnected.
* This is the initial state of the machine.
*/
DISCONNECTED,
/**
* The connection is in the process of connecting to the server.
* This state can be reached by issuing a connect() call from within the {@link #DISCONNECTED}
* state.
*/
CONNECTING,
/**
* The connection is successfully connected to the server and the stream has been initiated.
*/
CONNECTED,
2019-08-12 17:05:30 +02:00
/**
* THe connection is authenticated.
* In this state the connection is ready to send and receive stanzas.
*/
AUTHENTICATED,
2019-05-27 21:34:11 +02:00
/**
* The connection is in the process of shutting down.
*/
DISCONNECTING,
/**
* The device doesn't have usable network connectivity.
*/
WAITING_FOR_NETWORK,
/**
* The connection already (unsuccessfully) tried to connect, but failed due to lack of network
* connectivity and is now waiting to retry connecting.
*/
2019-09-30 03:08:27 +02:00
WAITING_FOR_RETRY
2019-05-27 21:34:11 +02:00
}