org.apache.catalina.ha.session
public class JvmRouteBinderValve extends ValveBase implements ClusterValve, Lifecycle
For this valve to function correctly, so that all nodes of the cluster
receive the sessionid change notifications that it generates, the following
ClusterListener MUST be configured at all nodes of the cluster:
JvmRouteSessionIDBinderListener
since Tomcat 5.5.10, and both
JvmRouteSessionIDBinderListener and JvmRouteSessionIDBinderLifecycleListener
for earlier versions of Tomcat.
Add this Valve to your host definition at conf/server.xml .
Since 5.5.10 as direct cluster valve:
<Cluster> <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve" /> </Cluster>
<Host> <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve" /> </Host>A Trick:
Version: $Revision: 892545 $ $Date: 2009-12-20 02:04:17 +0100 (Sun, 20 Dec 2009) $
Field Summary | |
---|---|
protected CatalinaCluster | cluster
the cluster |
protected boolean | enabled
enabled this component |
protected static String | info
The descriptive information about this implementation. |
protected LifecycleSupport | lifecycle
The lifecycle event support for this component. |
static Log | log |
protected long | numberOfSessions
number of session that no at this tomcat instanz hosted |
protected String | sessionIdAttribute |
protected StringManager | sm
The string manager for this package. |
protected boolean | started
Has this component been started yet? |
Method Summary | |
---|---|
void | addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
|
protected void | changeRequestSessionID(Request request, Response response, String sessionId, String newSessionID)
Change Request Session id |
protected void | changeSessionID(Request request, Response response, String sessionId, String newSessionID, Session catalinaSession)
change session id and send to all cluster nodes
|
LifecycleListener[] | findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
CatalinaCluster | getCluster() |
boolean | getEnabled() |
String | getInfo()
Return descriptive information about this implementation. |
protected String | getLocalJvmRoute(Request request)
get jvmroute from engine
|
protected Manager | getManager(Request request)
get Cluster DeltaManager
|
long | getNumberOfSessions() |
String | getSessionIdAttribute()
set session id attribute to failed node for request.
|
protected void | handleJvmRoute(Request request, Response response, String sessionId, String localJvmRoute)
Handle jvmRoute stickyness after tomcat instance failed. |
protected void | handlePossibleTurnover(Request request, Response response)
handle possible session turn over.
|
void | invoke(Request request, Response response)
Detect possible the JVMRoute change at cluster backup node..
|
void | removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
|
protected void | sendSessionIDClusterBackup(ClusterManager manager, Request request, String sessionId, String newSessionID)
Send the changed Sessionid to all clusternodes.
|
void | setCluster(CatalinaCluster cluster) |
void | setEnabled(boolean enabled) |
protected void | setNewSessionCookie(Request request, Response response, String sessionId)
Sets a new cookie for the given session id and response and see
configureSessionCookie
|
void | setSessionIdAttribute(String sessionIdAttribute)
get name of failed reqeust session attribute
|
void | start()
Prepare for the beginning of active use of the public methods of this
component. |
void | stop()
Gracefully terminate the active use of the public methods of this
component. |
Parameters: listener The listener to add
Parameters: request current request response current response sessionId original session id newSessionID new session id for node migration
Parameters: request current request response current response sessionId original session id newSessionID new session id for node migration catalinaSession current session with original session id
Returns: Returns the cluster.
Returns: Returns the enabled.
Parameters: request current request
Returns: return jvmRoute from ManagerBase or null
Parameters: request current request
Returns: manager or null
Returns: Returns the number of migrated sessions.
Returns: Returns the sessionIdAttribute.
Parameters: request current request response Tomcat Response sessionId request SessionID from Cookie localJvmRoute local jvmRoute
Parameters: request current request response current response
See Also: JvmRouteBinderValve
Parameters: request tomcat request being processed response tomcat response being processed
Throws: IOException if an input/output error has occurred ServletException if a servlet error has occurred
Parameters: listener The listener to add
Parameters: manager ClusterManager sessionId current failed sessionid newSessionID new session id, bind to the new cluster node
See Also: messageReceived
Parameters: cluster The cluster to set.
Parameters: enabled The enabled to set.
Deprecated: Use changeSessionId
Sets a new cookie for the given session id and response and see configureSessionCookieParameters: request current request response Tomcat Response sessionId The session id
Parameters: sessionIdAttribute The sessionIdAttribute to set.
configure()
,
and before any of the public methods of the component are utilized.
Throws: LifecycleException if this component detects a fatal error that prevents this component from being used
Throws: LifecycleException if this component detects a fatal error that needs to be reported