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:38:39 UTC

svn commit: r812446 - in /tomcat/sandbox/tomcat-oacc/trunk: docs/changelog.xml src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java src/share/org/apache/catalina/cluster/session/LocalStrings.properties

Author: rjung
Date: Tue Sep  8 10:38:38 2009
New Revision: 812446

URL: http://svn.apache.org/viewvc?rev=812446&view=rev
Log:
Port r795052 from TC5.5.x ha

Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=40551
Enable the JvmRouteBinderValve to work with PersistentManagers as well as clusters
Patch by Chris Chandler

Modified:
    tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml
    tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java
    tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/LocalStrings.properties

Modified: tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml?rev=812446&r1=812445&r2=812446&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml (original)
+++ tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml Tue Sep  8 10:38:38 2009
@@ -33,6 +33,11 @@
   <subsection name="Cluster">
       <changelog>
       <fix>
+        <bug>40551</bug>: Enable the JvmRouteBinderValve to work with
+        PersistentManagers as well as clustering. Patch by Chris Chandler.
+        Port from Tomcat 5.5. (rjung)
+      </fix>
+      <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)

Modified: tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java?rev=812446&r1=812445&r2=812446&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java (original)
+++ tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/JvmRouteBinderValve.java Tue Sep  8 10:38:38 2009
@@ -39,6 +39,7 @@
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.catalina.session.ManagerBase;
+import org.apache.catalina.session.PersistentManager;
 import org.apache.catalina.util.LifecycleSupport;
 import org.apache.catalina.util.StringManager;
 import org.apache.catalina.valves.ValveBase;
@@ -209,14 +210,18 @@
             ServletException {
 
          if (getEnabled() 
-             && getCluster() != null
              && request.getContext() != null
              && request.getContext().getDistributable() ) {
              // valve cluster can access manager - other cluster handle turnover 
              // at host level - hopefully!
              Manager manager = request.getContext().getManager();
-             if (manager != null && manager instanceof ClusterManager
-                     && getCluster().getManager(((ClusterManager)manager).getName()) != null)
+
+             if (manager != null && (
+                     (manager instanceof ClusterManager
+                       && getCluster() != null
+                       && getCluster().getManager(((ClusterManager)manager).getName()) != null)
+                     ||
+                     (manager instanceof PersistentManager)))
                  handlePossibleTurnover(request, response);
         }
         // Pass this request on to the next valve in our pipeline
@@ -377,9 +382,13 @@
         if (catalinaSession instanceof DeltaSession)
             ((DeltaSession) catalinaSession).resetDeltaRequest();
         changeRequestSessionID(request, response, sessionId, newSessionID);
-        // now sending the change to all other clusternode!
-        ClusterManager manager = (ClusterManager)catalinaSession.getManager();
-        sendSessionIDClusterBackup(manager,request,sessionId, newSessionID);
+
+        if (getCluster() != null) {
+            // now sending the change to all other clusternode!
+            ClusterManager manager = (ClusterManager)catalinaSession.getManager();
+            sendSessionIDClusterBackup(manager,request,sessionId, newSessionID);
+        }
+
         lifecycle.fireLifecycleEvent("After session migration", catalinaSession);
         if (log.isDebugEnabled()) {
             log.debug(sm.getString("jvmRoute.changeSession", sessionId,
@@ -549,13 +558,12 @@
                 }
             }
         }
-        if (cluster == null) {
-            throw new RuntimeException("No clustering support at container "
-                    + container.getName());
-        }
         
-        if (log.isInfoEnabled())
+        if (log.isInfoEnabled()) {
             log.info(sm.getString("jvmRoute.valve.started"));
+            if (cluster == null)
+                log.info(sm.getString("jvmRoute.noCluster"));
+        }
 
     }
 

Modified: tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/LocalStrings.properties?rev=812446&r1=812445&r2=812446&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/LocalStrings.properties (original)
+++ tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/LocalStrings.properties Tue Sep  8 10:38:38 2009
@@ -79,6 +79,7 @@
 jvmRoute.lostSession=Lost Session [{0}] at path [{1}]
 jvmRoute.missingJvmRouteAttribute=No engine jvmRoute attribute configured!
 jvmRoute.newSessionCookie=Setting cookie with session id [{0}] name: [{1}] path: [{2}] secure: [{3}]
+jvmRoute.noCluster=The JvmRouterBinderValve is configured, but clustering is not being used. Fail over will still work, providing a PersistentManager is used.
 jvmRoute.notFoundManager=Not found Cluster DeltaManager {0} at {1}
 jvmRoute.receiveMessage.sessionIDChanged=Cluster JvmRouteSessionIDBinderListener received orginal session ID [{0}] set to new id [{1}] for context path [{2}]
 jvmRoute.run.already=jvmRoute SessionID receiver run already



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org