Enum Class PageState
- All Implemented Interfaces:
Serializable,Comparable<PageState>,Constable
This enum tracks the connection state of a page to determine when it can be safely removed from memory. Pages transition through these states based on client signals and connection events.
State Transitions:
ACTIVE→DISCONNECTED: WebSocket/SSE connection closesDISCONNECTED→ACTIVE: Client reconnectsACTIVE→UNLOADED: Client sends pagehide beaconDISCONNECTED→UNLOADED: Timeout expires without reconnection
- Since:
- 2024
- Author:
- Marvin P. Warble Jr.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionPage is actively connected and communicating with the client.Page connection was lost but the client may reconnect.Page has been intentionally closed by the user. -
Method Summary
-
Enum Constant Details
-
ACTIVE
Page is actively connected and communicating with the client.The WebSocket or SSE connection is open and the page is receiving events.
-
DISCONNECTED
Page connection was lost but the client may reconnect.This state is entered when a WebSocket or SSE connection closes unexpectedly. The page remains in this state until either the client reconnects (returning to ACTIVE) or a timeout expires (transitioning to UNLOADED).
Common causes include network interruptions, mobile browser backgrounding, server restarts, or proxy timeouts.
-
UNLOADED
Page has been intentionally closed by the user.This state is entered when the client sends a pagehide beacon indicating the user has navigated away or closed the tab. Pages in this state are eligible for immediate cleanup.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-