Author: rjung
Date: Wed Nov 26 17:25:57 2014
New Revision: 1641864
URL: http://svn.apache.org/r1641864
Log:
The change in session ID is notified to not the session listener but the
container event listener.
Backport of r1152894 from TC 6.
Modified:
tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml
Modified: tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml?rev=1641864&r1=1641863&r2=1641864&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml (original)
+++ tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml Wed Nov 26 17:25:57 2014
@@ -32,6 +32,11 @@
<section name="Tomcat OACC 0.1 (rjung)">
<subsection name="Cluster">
<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>
+ <fix>
<bug>51306</bug>: Avoid NPE when handleSESSION_EXPIRED is processed
while handleSESSION_CREATED is being processed. (kfujino)
</fix>
Modified:
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java?rev=1641864&r1=1641863&r2=1641864&view=diff
==============================================================================
---
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java
(original)
+++
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java
Wed Nov 26 17:25:57 2014
@@ -117,6 +117,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;
@@ -525,6 +526,14 @@ public class DeltaManager extends Cluste
this.notifyListenersOnReplication = notifyListenersOnReplication;
}
+ public boolean isNotifyContainerListenersOnReplication() {
+ return notifyContainerListenersOnReplication;
+ }
+
+ public void setNotifyContainerListenersOnReplication(
+ boolean notifyContainerListenersOnReplication) {
+ this.notifyContainerListenersOnReplication =
notifyContainerListenersOnReplication;
+ }
/**
* @return Returns the defaultMode.
@@ -1753,7 +1762,15 @@ public class DeltaManager extends Cluste
if (session != null) {
String newSessionID = deserializeSessionId(msg.getSession());
session.setPrimarySession(false);
- session.setId(newSessionID, notifyListenersOnReplication);
+ session.setId(newSessionID, false);
+ if (notifyContainerListenersOnReplication) {
+ Container c = getContainer();
+ if (c instanceof StandardContext) {
+ ((StandardContext) getContainer()).fireContainerEvent(
+ Context.CHANGE_SESSION_ID_EVENT,
+ new String[] {msg.getSessionID(), newSessionID});
+ }
+ }
}
}
Modified:
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml?rev=1641864&r1=1641863&r2=1641864&view=diff
==============================================================================
---
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml
(original)
+++
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/mbeans-descriptors.xml
Wed Nov 26 17:25:57 2014
@@ -311,6 +311,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="sendAllSessions"
is="true"
description="Send all sessions at one big block"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]