Author: fhanik Date: Fri Oct 13 11:21:47 2006 New Revision: 463768 URL: http://svn.apache.org/viewvc?view=rev&rev=463768 Log: slow progress, but moving forward with documentation
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/ClusterValve.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-valve.xml tomcat/tc6.0.x/trunk/webapps/docs/config/cluster.xml Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/ClusterValve.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/ClusterValve.java?view=diff&rev=463768&r1=463767&r2=463768 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/ClusterValve.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/ClusterValve.java Fri Oct 13 11:21:47 2006 @@ -15,13 +15,16 @@ */ package org.apache.catalina.ha; +import org.apache.catalina.Valve; + /** - * Cluster Valve Interface to mark all Cluster Valves - * Only those Valve can'be configured as Cluster Valves + * Cluster valves are a simple extension to the Tomcat valve architecture + * with a small addition of being able to reference the cluster component in the container it sits in. + * @author Filip Hanik * @author Peter Rossbach * @version $Revision: 303842 $, $Date: 2005-04-10 11:20:46 -0500 (Sun, 10 Apr 2005) $ */ -public interface ClusterValve { +public interface ClusterValve extends Valve{ /** * Returns the cluster the cluster deployer is associated with * @return CatalinaCluster Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java?view=diff&rev=463768&r1=463767&r2=463768 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/tcp/ReplicationValve.java Fri Oct 13 11:21:47 2006 @@ -212,7 +212,7 @@ /** * Calc processing stats */ - public boolean isDoProcessingStats() { + public boolean doStatistics() { return doProcessingStats; } @@ -220,7 +220,7 @@ * Set Calc processing stats * @see #resetStatistics() */ - public void setDoProcessingStats(boolean doProcessingStats) { + public void setStatistics(boolean doProcessingStats) { this.doProcessingStats = doProcessingStats; } @@ -326,7 +326,7 @@ long totalstart = 0; //this happens before the request - if(isDoProcessingStats()) { + if(doStatistics()) { totalstart = System.currentTimeMillis(); } if (primaryIndicator) { @@ -415,7 +415,7 @@ protected void sendReplicationMessage(Request request, long totalstart, boolean isCrossContext, ClusterManager clusterManager, CatalinaCluster containerCluster) { //this happens after the request long start = 0; - if(isDoProcessingStats()) { + if(doStatistics()) { start = System.currentTimeMillis(); } try { @@ -432,7 +432,7 @@ log.error(sm.getString("ReplicationValve.send.failure"), x); } finally { // FIXME this stats update are not cheap!! - if(isDoProcessingStats()) { + if(doStatistics()) { updateStats(totalstart,start); } } @@ -452,7 +452,7 @@ log.debug(sm.getString("ReplicationValve.crossContext.sendDelta", session.getManager().getContainer().getName() )); sendMessage(session,(ClusterManager)session.getManager(),containerCluster); - if(isDoProcessingStats()) { + if(doStatistics()) { nrOfCrossContextSendRequests++; } } @@ -515,7 +515,7 @@ log.debug(sm.getString("ReplicationValve.invoke.uri", uri)); sendMessage(session,manager,cluster); } else - if(isDoProcessingStats()) + if(doStatistics()) nrOfFilterRequests++; } @@ -551,7 +551,7 @@ } else { cluster.send(msg); } - if(isDoProcessingStats()) + if(doStatistics()) nrOfSendRequests++; } } Modified: tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-valve.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-valve.xml?view=diff&rev=463768&r1=463767&r2=463768 ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-valve.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-valve.xml Fri Oct 13 11:21:47 2006 @@ -8,36 +8,64 @@ <properties> <author email="[EMAIL PROTECTED]">Filip Hanik</author> - <title>The Channel object</title> + <title>The Cluster Valve object</title> </properties> <body> <section name="Introduction"> - - - + <p> + A cluster valve is no different from any other <a href="valve.html">Tomcat <code>Valve</code></a>. + The cluster valves are interceptors in the invokation chain for HTTP requests, and the clustering implementation + uses these valves to make intelligent decision around data and when data should be replicated. + </p> + <p> + A cluster valve must implement the <code>org.apache.catalina.ha.ClusterValve</code> interface. + This is a simple interface that extends the <code>org.apache.catalina.Valve</code> interface. + </p> </section> - -<section name="Attributes"> - - <subsection name="Common Attributes"> - - <attributes> - - <attribute name="className" required="true"> - - </attribute> - - - </attributes> - - +<section name="org.apache.catalina.ha.tcp.ReplicationValve"> + The <code>ReplicationValve</code> 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. + <subsection name="Attributes"> + <attributes> + <attribute name="className" required="true"> + Set value to <code>org.apache.catalina.ha.tcp.ReplicationValve</code> + </attribute> + <attribute name="filter" required="false"> + For known file extensions or urls, you can use a filter 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 there is a filter match, the cluster assumes there has been no session change. + An example filter would look like <code>filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"</code> + The filter uses regular expressions and each filter is delimited by a semi colon. + <code>Pattern#compile(java.lang.String)</code> + </attribute> + <attribute name="className" required="false"> + </attribute> + <attribute name="className" required="false"> + </attribute> + <attribute name="statistics" required="false"> + Boolean value. Set to <code>true</code> if you want the valve to collect request statistics. + Default value is <code>false</code> + </attribute> + </attributes> </subsection> +</section> - +<section name="org.apache.catalina.ha.session.JvmRouteBinderValve"> + In case of a mod_jk failover, the <code>JvmRouteBinderValve</code> will replace the + <code>jvmWorker</code> 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. + <subsection name="Attributes"> + <attributes> + <attribute name="className" required="true"> + </attribute> + </attributes> + </subsection> </section> Modified: tomcat/tc6.0.x/trunk/webapps/docs/config/cluster.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/config/cluster.xml?view=diff&rev=463768&r1=463767&r2=463768 ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/config/cluster.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/config/cluster.xml Fri Oct 13 11:21:47 2006 @@ -24,6 +24,16 @@ making the configuration seem like a lot, but don't lose faith, instead you have a tremendous control over what is going on.</p> </section> +<section name="Engine vs Host placement"> + <p> + You can place the <code><Cluster></code> element inside either the <code><Engine></code> + container or the <code><Host></code> container.<br/> + Placing it in the engine, means that you will support clustering in all virtual hosts of Tomcat, + and share the messaging component. When you place the <code><Cluster></code> inside the <code><Engine></code> + element, the cluster will append the host name of each session manager to the managers name so that two contexts with + the same name but sitting inside two different hosts will be distinguishable. + </p> +</section> <section name="Context Attribute Replication"> <p>To configure context attribute replication, simply do this by swapping out the context implementation used for your application context. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]