Package com.oorian

Enum Class PageState

All Implemented Interfaces:
Serializable, Comparable<PageState>, Constable

public enum PageState extends Enum<PageState>
Represents the lifecycle state of an HtmlPage.

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:

  • ACTIVEDISCONNECTED: WebSocket/SSE connection closes
  • DISCONNECTEDACTIVE: Client reconnects
  • ACTIVEUNLOADED: Client sends pagehide beacon
  • DISCONNECTEDUNLOADED: Timeout expires without reconnection
Since:
2024
Author:
Marvin P. Warble Jr.
  • Enum Constant Details

    • ACTIVE

      public static final PageState ACTIVE
      Page is actively connected and communicating with the client.

      The WebSocket or SSE connection is open and the page is receiving events.

    • DISCONNECTED

      public static final PageState 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

      public static final PageState 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

      public static PageState[] 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

      public static PageState valueOf(String name)
      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 name
      NullPointerException - if the argument is null