Author: markt
Date: Fri Jul 17 11:38:11 2009
New Revision: 795052

URL: http://svn.apache.org/viewvc?rev=795052&view=rev
Log:
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/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java
    
tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/LocalStrings.properties
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: 
tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java?rev=795052&r1=795051&r2=795052&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/JvmRouteBinderValve.java
 Fri Jul 17 11:38:11 2009
@@ -38,6 +38,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;
@@ -195,14 +196,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
@@ -357,9 +362,13 @@
             }
             request.setAttribute(sessionIdAttribute, sessionId);
         }
-        // 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()) {
@@ -507,13 +516,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/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/LocalStrings.properties?rev=795052&r1=795051&r2=795052&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/LocalStrings.properties
 (original)
+++ 
tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/ha/session/LocalStrings.properties
 Fri Jul 17 11:38:11 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

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=795052&r1=795051&r2=795052&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Fri Jul 17 11:38:11 2009
@@ -287,6 +287,11 @@
         Fix minor memory leak found by find bugs. (markt, rjung)
       </fix>
       <fix>
+        <bug>40551</bug>: Enable the JvmRouteBinderValve to work with
+        PersistentManagers as well as clustering. Patch by Chris Chandler.
+        (markt)
+      </fix>
+      <fix>
         <bug>46357</bug>: Corrected test for host's parent must be an engine.
         (markt, rjung)
       </fix>



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

Reply via email to