The Apache Tomcat Servlet/JSP Container

Apache Tomcat 7

Version 7.0.39, Mar 22 2013
Apache Logo

Links

Top Level Elements

Executors

Connectors

Containers

Nested Components

Cluster Elements

Other

The Cluster Valve object

Table of Contents
Introduction

A cluster valve is no different from any other Tomcat Valve. The cluster valves are interceptors in the invocation chain for HTTP requests, and the clustering implementation uses these valves to make intelligent decision around data and when data should be replicated.

A cluster valve must implement the org.apache.catalina.ha.ClusterValve interface. This is a simple interface that extends the org.apache.catalina.Valve interface.

org.apache.catalina.ha.tcp.ReplicationValve
The ReplicationValve will notify the cluster at the end of a HTTP request so that the cluster can make a decision whether there is data to be replicated or not.
Attributes
AttributeDescription
className Set value to org.apache.catalina.ha.tcp.ReplicationValve
filter For known file extensions or urls, you can use this Valve to notify the cluster that the session has not been modified during this request and the cluster doesn't have to probe the session managers for changes. If the request matches this filter pattern, the cluster assumes there has been no session change. An example filter would look like filter=".*\.gif|.*\.js|.*\.jpeg|.*\.jpg|.*\.png|.*\.htm|.*\.html|.*\.css|.*\.txt" . The filter is a regular expression using java.util.regex.
primaryIndicator Boolean value, so to true, and the replication valve will insert a request attribute with the name defined by the primaryIndicatorName attribute. The value inserted into the request attribute is either Boolean.TRUE or Boolean.FALSE
primaryIndicatorName Default value is org.apache.catalina.ha.tcp.isPrimarySession The value defined here is the name of the request attribute that contains the boolean value if the session is primary on this server or not.
statistics Boolean value. Set to true if you want the valve to collect request statistics. Default value is false
org.apache.catalina.ha.session.JvmRouteBinderValve
In case of a mod_jk failover, the JvmRouteBinderValve will replace the jvmWorker attribute in the session Id, to make future requests stick to this node. If you want failback capability, don't enable this valve, but if you want your failover to stick, and for mod_jk not to have to keep probing the node that went down, you use this valve.
Attributes
AttributeDescription
className org.apache.catalina.ha.session.JvmRouteBinderValve
enabled Default value is true Runtime attribute to turn on and off turn over of the session's jvmRoute value.
Comments

Notice: This is not a Q&A section. The Apache Comments System is explained here. Comments should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic.

Questions on how to configure or use Apache Tomcat should be directed to our mailing lists. If you need help, ask on the users mailing list.


Copyright © 1999-2013, Apache Software Foundation