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

44 lines
1.1 KiB
Java
Raw Normal View History

2019-08-03 19:05:50 +02:00
package org.mercury_im.messenger.core;
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.
* In this state the connection is ready to send and receive stanzas.
*/
CONNECTED,
/**
* 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.
*/
WAIRING_FOR_RETRY
}