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

# Class ClusterSessionListener

java.lang.Object
org.apache.catalina.ha.ClusterListener
org.apache.catalina.ha.session.ClusterSessionListener

All Implemented Interfaces:
  `ChannelListener`

public class ClusterSessionListener extends ClusterListener
Receive replicated SessionMessage form other cluster node.

- ## Field Summary

  ### Fields inherited from class ClusterListener

  `cluster`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClusterSessionListener()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `accept(ClusterMessage msg)`
  Accept only a certain type of messages.
  `void`
  `messageReceived(ClusterMessage myobj)`
  Callback from the cluster, when a message is received, The cluster will broadcast it invoking the messageReceived on the receiver.

  ### Methods inherited from class ClusterListener

  `accept, getCluster, messageReceived, setCluster`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ClusterSessionListener

    public ClusterSessionListener()

- ## Method Details

  - ### messageReceived

    public void messageReceived(ClusterMessage myobj)
    Description copied from class: `ClusterListener`
    Callback from the cluster, when a message is received, The cluster will broadcast it invoking the messageReceived on the receiver.
    Specified by:
      `messageReceived` in class `ClusterListener`
    Parameters:
      `myobj` - the message received from the cluster

  - ### accept

    public boolean accept(ClusterMessage msg)
    Accept only a certain type of messages.

    This listener accepts only SessionMessage.

    Specified by:
      `accept` in class `ClusterListener`
    Parameters:
      `msg` - the message
    Returns:
      `true` to indicate that messageReceived should be invoked. If `false` is returned, the messageReceived method will not be invoked.