2011/6/29 <ma...@apache.org>: > Author: markt > Date: Tue Jun 28 19:32:39 2011 > New Revision: 1140801 > > URL: http://svn.apache.org/viewvc?rev=1140801&view=rev > Log: > Notifications of changes in session ID to other nodes in the cluster should > be controlled by notifySessionListenersOnReplication rather than > notifyListenersOnReplication. > > Modified: > tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java > tomcat/trunk/webapps/docs/changelog.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=1140801&r1=1140800&r2=1140801&view=diff > ============================================================================== > --- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java > (original) > +++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaManager.java Tue > Jun 28 19:32:39 2011 > @@ -1463,7 +1463,7 @@ public CatalinaCluster getCluster() { > if (session != null) { > String newSessionID = deserializeSessionId(msg.getSession()); > session.setPrimarySession(false); > - session.setId(newSessionID, notifyListenersOnReplication); > + session.setId(newSessionID, notifySessionListenersOnReplication); > } > } > >
A primary node never trigger a notification to any session listeners. It notifies container event listener now. Should non-primary node be same behavior as a primary node? If it notifies not session listener but container event listener, I will add some changes below. Comments? === Index: java/org/apache/catalina/ha/session/DeltaManager.java =================================================================== --- java/org/apache/catalina/ha/session/DeltaManager.java (revision 1140984) +++ java/org/apache/catalina/ha/session/DeltaManager.java (working copy) @@ -97,6 +97,7 @@ private boolean expireSessionsOnShutdown = false; private boolean notifyListenersOnReplication = true; private boolean notifySessionListenersOnReplication = true; + private boolean notifyChangeSessionIDEventOnReplication = true; private volatile boolean stateTransfered = false ; private int stateTransferTimeout = 60; private boolean sendAllSessions = true; @@ -420,6 +421,14 @@ this.notifyListenersOnReplication = notifyListenersOnReplication; } + public boolean isNotifyChangeSessionIDEventOnReplication() { + return notifyChangeSessionIDEventOnReplication; + } + + public void setNotifyChangeSessionIDEventOnReplication( + boolean notifyChangeSessionIDEventOnReplication) { + this.notifyChangeSessionIDEventOnReplication = notifyChangeSessionIDEventOnReplication; + } @Override public CatalinaCluster getCluster() { @@ -1463,7 +1472,11 @@ if (session != null) { String newSessionID = deserializeSessionId(msg.getSession()); session.setPrimarySession(false); - session.setId(newSessionID, notifySessionListenersOnReplication); + session.setId(newSessionID, false); + if (notifyChangeSessionIDEventOnReplication) { + getContainer().fireContainerEvent(Context.CHANGE_SESSION_ID_EVENT, + new String[] {msg.getSessionID(), newSessionID}); + } } } === -- Keiichi.Fujino --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org