Author: markt
Date: Thu Jul 16 20:07:19 2009
New Revision: 794822
URL: http://svn.apache.org/viewvc?rev=794822&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
Modified:
tomcat/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties
Modified:
tomcat/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java?rev=794822&r1=794821&r2=794822&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
Thu Jul 16 20:07:19 2009
@@ -40,6 +40,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.tomcat.util.res.StringManager;
import org.apache.catalina.valves.ValveBase;
@@ -197,14 +198,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
@@ -362,9 +367,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,
@@ -535,13 +544,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/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties?rev=794822&r1=794821&r2=794822&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties
Thu Jul 16 20:07:19 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. You must use a PersistentManager for fail-over
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: [email protected]
For additional commands, e-mail: [email protected]