17.11. Clustered Session Notification Policy

This section introduces the concept of a clustered session notification policy for determining whether the servlet spec notifications related to session events are allowed to be emitted on the local cluster node. Such notifications are emitted to implementations of the javax.servlet.http.HttpSessionListener, javax.servlet.http.HttpSessionAttributeListener, and javax.servlet.http.HttpSessionBindingListener interfaces.
This new notification policy concept is defined in the org.jboss.web.tomcat.service.session.notification Java package, and all classes referenced below are a part of this package.
While it is possible to implement ClusteredSessionNotificationPolicy for case-specific customization, JBoss provides LegacyClusteredSessionNotificationPolicy, which implements the behavior in previous JBoss versions (the default), and IgnoreUndeployLegacyClusteredSessionNotificationPolicy, which implements the same behavior except for undeployment situations in which no HttpSessionListener and HttpSessionAttributeListener notifications are sent.
It is possible to change from the default LegacyClusteredSessionNotificationPolicy to IgnoreUndeployLegacyClusteredSessionNotificationPolicy or to a custom ClusteredSessionNotificationPolicy implementation by performing one of the following steps:
  • Using the system property 'jboss.web.clustered.session.notification.policy' and setting it equal to the class name of the policy you want to choose. This will change the policy for all web applications deployed in the application server.
  • Using jboss-web.xml to set the policy per application using the following format:
    <replication-config>
     <session-notification-policy>
      CLASS-NAME-HERE
     </session-notification-policy>
    </replication-config>
    

Note

The session-notification-policy element shown above is not part of the official DTD for a JBoss 4.2+ jboss-web.xml (see http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd). However, the internal jboss-web.xml parsing logic will properly handle the element in JBoss AS 4.2.4 and later as well was in EAP 4.2.0.GA_CP05 and 4.3.0.GA_CP03 and later.