Author: kfujino Date: Thu Jun 30 08:39:53 2011 New Revision: 1141441 URL: http://svn.apache.org/viewvc?rev=1141441&view=rev Log: The change in session ID is notified to the container event listener.
Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/cluster-manager.xml Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java?rev=1141441&r1=1141440&r2=1141441&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java (original) +++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Thu Jun 30 08:39:53 2011 @@ -97,6 +97,7 @@ public class DeltaManager extends Cluste private boolean expireSessionsOnShutdown = false; private boolean notifyListenersOnReplication = true; private boolean notifySessionListenersOnReplication = true; + private boolean notifyContainerListenersOnReplication = true; private volatile boolean stateTransfered = false ; private int stateTransferTimeout = 60; private boolean sendAllSessions = true; @@ -420,9 +421,17 @@ public class DeltaManager extends Cluste this.notifyListenersOnReplication = notifyListenersOnReplication; } + public boolean isNotifyContainerListenersOnReplication() { + return notifyContainerListenersOnReplication; + } + + public void setNotifyContainerListenersOnReplication( + boolean notifyContainerListenersOnReplication) { + this.notifyContainerListenersOnReplication = notifyContainerListenersOnReplication; + } - @Override -public CatalinaCluster getCluster() { + @Override + public CatalinaCluster getCluster() { return cluster; } @@ -1463,7 +1472,11 @@ public CatalinaCluster getCluster() { if (session != null) { String newSessionID = deserializeSessionId(msg.getSession()); session.setPrimarySession(false); - session.setId(newSessionID, notifySessionListenersOnReplication); + session.setId(newSessionID, false); + if (notifyContainerListenersOnReplication) { + getContainer().fireContainerEvent(Context.CHANGE_SESSION_ID_EVENT, + new String[] {msg.getSessionID(), newSessionID}); + } } } @@ -1494,6 +1507,7 @@ public CatalinaCluster getCluster() { result.expireSessionsOnShutdown = expireSessionsOnShutdown; result.notifyListenersOnReplication = notifyListenersOnReplication; result.notifySessionListenersOnReplication = notifySessionListenersOnReplication; + result.notifyContainerListenersOnReplication = notifyContainerListenersOnReplication; result.stateTransferTimeout = stateTransferTimeout; result.sendAllSessions = sendAllSessions; result.sendAllSessionsSize = sendAllSessionsSize; Modified: tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml?rev=1141441&r1=1141440&r2=1141441&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml (original) +++ tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml Thu Jun 30 08:39:53 2011 @@ -249,6 +249,11 @@ description="Send session start/stop events on backup nodes" type="boolean"/> <attribute + name="notifyContainerListenersOnReplication" + is="true" + description="Send container events on backup nodes" + type="boolean"/> + <attribute name="processExpiresFrequency" description="The frequency of the manager checks (expiration and passivation)" type="int"/> Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1141441&r1=1141440&r2=1141441&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Jun 30 08:39:53 2011 @@ -238,6 +238,12 @@ should be controlled by notifySessionListenersOnReplication rather than notifyListenersOnReplication. (markt) </fix> + <fix> + The change in session ID is notified to the container event listener on + the backup node in cluster. + This notification is controlled by + notifyContainerListenersOnReplication.(kfujino) + </fix> </changelog> </subsection> <subsection name="Web applications"> Modified: tomcat/trunk/webapps/docs/config/cluster-manager.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/cluster-manager.xml?rev=1141441&r1=1141440&r2=1141441&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/cluster-manager.xml (original) +++ tomcat/trunk/webapps/docs/config/cluster-manager.xml Thu Jun 30 08:39:53 2011 @@ -105,6 +105,10 @@ when sessions are created and expired across Tomcat nodes in the cluster. </attribute> + <attribute name="notifyContainerListenersOnReplication" required="false"> + Set to <code>true</code> if you wish to have container listeners notified + across Tomcat nodes in the cluster. + </attribute> <attribute name="stateTransferTimeout" required="false"> The time in seconds to wait for a session state transfer to complete from another node when a node is starting up. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org