SessionMessage (Apache Tomcat 9.0.111 API Documentation)
Description: declaration: package: org.apache.catalina.ha.session, interface: SessionMessage

# Interface SessionMessage

All Superinterfaces:
  `ClusterMessage, Serializable`

All Known Implementing Classes:
  `SessionMessageImpl`

public interface SessionMessage extends ClusterMessage
The SessionMessage interface is used when a session has been created, modified, expired in a Tomcat cluster node.

The following events are currently available:

- `public static final int EVT_SESSION_CREATED`
- `public static final int EVT_SESSION_EXPIRED`
- `public static final int EVT_SESSION_ACCESSED`
- `public static final int EVT_GET_ALL_SESSIONS`
- `public static final int EVT_SESSION_DELTA`
- `public static final int EVT_ALL_SESSION_DATA`
- `public static final int EVT_ALL_SESSION_TRANSFERCOMPLETE`
- `public static final int EVT_CHANGE_SESSION_ID`
- `public static final int EVT_ALL_SESSION_NOCONTEXTMANAGER`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `EVT_ALL_SESSION_DATA`
  When a session state is transferred, this is the event.
  `static final int`
  `EVT_ALL_SESSION_NOCONTEXTMANAGER`
  Event type used when context manager doesn't exist.
  `static final int`
  `EVT_ALL_SESSION_TRANSFERCOMPLETE`
  When a session state is complete transferred, this is the event.
  `static final int`
  `EVT_CHANGE_SESSION_ID`
  Event type used when a sessionID has been changed.
  `static final int`
  `EVT_GET_ALL_SESSIONS`
  Event type used when a server comes online for the first time.
  `static final int`
  `EVT_SESSION_ACCESSED`
  Event type used when a session has been accessed (ie, last access time has been updated).
  `static final int`
  `EVT_SESSION_CREATED`
  Event type used when a session has been created on a node
  `static final int`
  `EVT_SESSION_DELTA`
  Event type used when an attribute has been added to a session, the attribute will be sent to all the other nodes in the cluster
  `static final int`
  `EVT_SESSION_EXPIRED`
  Event type used when a session has expired

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getContextName()`
  `int`
  `getEventType()`
  returns the event type
  `String`
  `getEventTypeString()`
  Clear text event type name (for logging purpose only).
  `byte[]`
  `getSession()`
  `String`
  `getSessionID()`

  ### Methods inherited from interface ClusterMessage

  `getAddress, getTimestamp, getUniqueId, setAddress, setTimestamp`

- ## Field Details

  - ### EVT_SESSION_CREATED

    static final int EVT_SESSION_CREATED
    Event type used when a session has been created on a node
    See Also:
      - Constant Field Values

  - ### EVT_SESSION_EXPIRED

    static final int EVT_SESSION_EXPIRED
    Event type used when a session has expired
    See Also:
      - Constant Field Values

  - ### EVT_SESSION_ACCESSED

    static final int EVT_SESSION_ACCESSED
    Event type used when a session has been accessed (ie, last access time has been updated). This is used so that the replicated sessions will not expire on the network
    See Also:
      - Constant Field Values

  - ### EVT_GET_ALL_SESSIONS

    static final int EVT_GET_ALL_SESSIONS
    Event type used when a server comes online for the first time. The first thing the newly started server wants to do is to grab the all the sessions from one of the nodes and keep the same state in there
    See Also:
      - Constant Field Values

  - ### EVT_SESSION_DELTA

    static final int EVT_SESSION_DELTA
    Event type used when an attribute has been added to a session, the attribute will be sent to all the other nodes in the cluster
    See Also:
      - Constant Field Values

  - ### EVT_ALL_SESSION_DATA

    static final int EVT_ALL_SESSION_DATA
    When a session state is transferred, this is the event.
    See Also:
      - Constant Field Values

  - ### EVT_ALL_SESSION_TRANSFERCOMPLETE

    static final int EVT_ALL_SESSION_TRANSFERCOMPLETE
    When a session state is complete transferred, this is the event.
    See Also:
      - Constant Field Values

  - ### EVT_CHANGE_SESSION_ID

    static final int EVT_CHANGE_SESSION_ID
    Event type used when a sessionID has been changed.
    See Also:
      - Constant Field Values

  - ### EVT_ALL_SESSION_NOCONTEXTMANAGER

    static final int EVT_ALL_SESSION_NOCONTEXTMANAGER
    Event type used when context manager doesn't exist. This is used when the manager which send a session state does not exist.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getContextName

    String getContextName()
    Returns:
      the context name associated with this message

  - ### getEventTypeString

    String getEventTypeString()
    Clear text event type name (for logging purpose only).
    Returns:
      the event type in a string representation, useful for debugging

  - ### getEventType

    int getEventType()
    returns the event type
    Returns:
      one of the event types EVT_XXXX

  - ### getSession

    byte[] getSession()
    Returns:
      the serialized data for the session

  - ### getSessionID

    String getSessionID()
    Returns:
      the session ID for the session