You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2009/09/08 12:11:46 UTC
svn commit: r812427 - in /tomcat/sandbox/tomcat-oacc/trunk:
docs/changelog.xml
src/share/org/apache/catalina/cluster/session/DeltaManager.java
src/share/org/apache/catalina/cluster/session/DeltaSession.java
Author: rjung
Date: Tue Sep 8 10:11:45 2009
New Revision: 812427
URL: http://svn.apache.org/viewvc?rev=812427&view=rev
Log:
DeltaManager needs to replicate changed attributes even if session
gets invalidated. Otherwise session listeners will not see the right
data on the secondary nodes.
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/DeltaSession.java
Modified: tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml?rev=812427&r1=812426&r2=812427&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml (original)
+++ tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml Tue Sep 8 10:11:45 2009
@@ -33,6 +33,11 @@
<subsection name="Cluster">
<changelog>
<fix>
+ DeltaManager needs to replicate changed attributes even if session
+ gets invalidated. Otherwise session listeners will not see the right
+ data on the secondary nodes. (rjung)
+ </fix>
+ <fix>
<bug>39603</bug>: Admin app only showed ROOT web application when
clustering was enabled.
Port from Tomcat 5.5. (rjung)
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=812427&r1=812426&r2=812427&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 Tue Sep 8 10:11:45 2009
@@ -1309,6 +1309,25 @@
* @return a SessionMessage to be sent,
*/
public ClusterMessage requestCompleted(String sessionId) {
+ return requestCompleted(sessionId, false);
+ }
+
+ /**
+ * When the request has been completed, the replication valve will notify
+ * the manager, and the manager will decide whether any replication is
+ * needed or not. If there is a need for replication, the manager will
+ * create a session message and that will be replicated. The cluster
+ * determines where it gets sent.
+ *
+ * Session expiration also calls this method, but with expires == true.
+ *
+ * @param sessionId -
+ * the sessionId that just completed.
+ * @param expires -
+ * whether this method has been called during session expiration
+ * @return a SessionMessage to be sent,
+ */
+ public ClusterMessage requestCompleted(String sessionId, boolean expires) {
try {
DeltaSession session = (DeltaSession) findSession(sessionId);
DeltaRequest deltaRequest = session.getDeltaRequest();
@@ -1326,7 +1345,7 @@
}
}
if(!isDeltaRequest) {
- if(!session.isPrimarySession()) {
+ if(!expires && !session.isPrimarySession()) {
counterSend_EVT_SESSION_ACCESSED++;
msg = new SessionMessageImpl(getName(),
SessionMessage.EVT_SESSION_ACCESSED, null, sessionId,
@@ -1344,9 +1363,10 @@
getName(), sessionId));
}
}
- session.setPrimarySession(true);
+ if (!expires)
+ session.setPrimarySession(true);
//check to see if we need to send out an access message
- if ((msg == null)) {
+ if (!expires && (msg == null)) {
long replDelta = System.currentTimeMillis()
- session.getLastTimeReplicated();
if (replDelta >= updateActiveInterval*1000 ||
Modified: tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java?rev=812427&r1=812426&r2=812427&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java (original)
+++ tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaSession.java Tue Sep 8 10:11:45 2009
@@ -49,7 +49,9 @@
import org.apache.catalina.Session;
import org.apache.catalina.SessionEvent;
import org.apache.catalina.SessionListener;
+import org.apache.catalina.cluster.CatalinaCluster;
import org.apache.catalina.cluster.ClusterSession;
+import org.apache.catalina.cluster.ClusterMessage;
import org.apache.catalina.realm.GenericPrincipal;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.StringManager;
@@ -718,6 +720,19 @@
expiring = true;
+ if(expiredId != null && manager instanceof DeltaManager) {
+ DeltaManager dmanager = (DeltaManager)manager;
+ CatalinaCluster cluster = dmanager.getCluster();
+ ClusterMessage msg = dmanager.requestCompleted(expiredId, true);
+ if (msg != null) {
+ if(dmanager.isSendClusterDomainOnly()) {
+ cluster.sendClusterDomain(msg);
+ } else {
+ cluster.send(msg);
+ }
+ }
+ }
+
// Notify interested application event listeners
// FIXME - Assumes we call listeners in reverse order
Context context = (Context) manager.getContainer();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org