Add heartbeatBackgroundEnabled to enable channel heartbeat call.
authorpero <pero@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 26 Apr 2007 21:09:41 +0000 (21:09 +0000)
committerpero <pero@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 26 Apr 2007 21:09:41 +0000 (21:09 +0000)
Don't forget to disable the GroupChannel heartbeat thread.
Default is false.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@532865 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
java/org/apache/catalina/ha/tcp/mbeans-descriptors.xml
webapps/docs/changelog.xml
webapps/docs/config/cluster.xml

index 3da5023..6673ab3 100644 (file)
@@ -126,6 +126,12 @@ public class SimpleTcpCluster
     protected String clusterName ;
 
     /**
+     * call Channel.heartbeat() at container background thread
+     * @see org.apache.catalina.tribes.group.GroupChannel#heartbeat()
+     */
+    protected boolean heartbeatBackgroundEnabled =false ;
+    
+    /**
      * The Container associated with this Cluster.
      */
     protected Container container = null;
@@ -188,6 +194,22 @@ public class SimpleTcpCluster
     }
 
     /**
+     * Return heartbeat enable flag (default false)
+     * @return the heartbeatBackgroundEnabled
+     */
+    public boolean isHeartbeatBackgroundEnabled() {
+        return heartbeatBackgroundEnabled;
+    }
+
+    /**
+     * enabled that container backgroundThread call heartbeat at channel
+     * @param heartbeatBackgroundEnabled the heartbeatBackgroundEnabled to set
+     */
+    public void setHeartbeatBackgroundEnabled(boolean heartbeatBackgroundEnabled) {
+        this.heartbeatBackgroundEnabled = heartbeatBackgroundEnabled;
+    }
+
+    /**
      * Set the name of the cluster to join, if no cluster with this name is
      * present create one.
      * 
@@ -584,12 +606,15 @@ public class SimpleTcpCluster
      * invoked inside the classloading context of this container. Unexpected
      * throwables will be caught and logged.
      * @see org.apache.catalina.ha.deploy.FarmWarDeployer#backgroundProcess()
-     * @see ReplicationTransmitter#backgroundProcess()
+     * @see org.apache.catalina.tribes.group.GroupChannel#heartbeat()
+     * @see org.apache.catalina.tribes.group.GroupChannel.HeartbeatThread#run()
+     * 
      */
     public void backgroundProcess() {
         if (clusterDeployer != null) clusterDeployer.backgroundProcess();
-        //send a heartbeat through the channel
-        if ( channel !=null ) channel.heartbeat();
+       
+        //send a heartbeat through the channel        
+        if ( isHeartbeatBackgroundEnabled() && channel !=null ) channel.heartbeat();
     }
 
     /**
index ac04140..e051aee 100644 (file)
     <attribute   name="notifyLifecycleListenerOnFailure"
           description="notify lifecycleListener from message transfer failure"
                             is="true"
-                 type="boolean"/>                 
-    <attribute   name="clusterName"
+                 type="boolean"/>  
+    <attribute   name="heartbeatBackgroundEnabled"
+          description="enable that container background thread call channel heartbeat, default is that channel mangage heartbeat itself."
+                            is="true"
+                 type="boolean"/>  
+     <attribute   name="clusterName"
           description="name of cluster"
                  type="java.lang.String"/>
     <attribute   name="managerClassName"
                  type="org.apache.catalina.ha.ClusterMessage"/>
     </operation>
         
-    <operation   name="sendToMember"
-               description="send message to one cluster member"
-               impact="ACTION"
-               returnType="void">
-      <parameter name="message"
-                 description="replication message"
-                 type="org.apache.catalina..cluster.ClusterMessage"/>
-      <parameter name="member"
-                 description="cluster member"
-                 type="java.lang.String"/>
-    </operation>
-
     <operation   name="start"
                description="Start the cluster"
                impact="ACTION"
index 68b88d3..2b2c3fa 100644 (file)
   </properties>
 
 <body>
+<section name="Tomcat 6.0.13 (remm)">
+  <subsection name="Cluster">
+    <changelog>
+      <fix>
+         Add heartbeatBackgroundEnabled flag to SimpleTcpCluster. 
+         Enable this flag don't forget to disable the channel heartbeat thread (pero)
+      </fix>
+    </changelog>
+  </subsection>
+</section>
 <section name="Tomcat 6.0.12 (remm)">
   <subsection name="General">
     <changelog>
index 5a16220..e4451f5 100644 (file)
       </p>
     </attribute>
 
+    <attribute name="heartbeatBackgroundEnabled" required="false">
+      <p>Enable this flag don't forget to disable the channel heartbeat thread.
+      </p>
+    </attribute>
     <attribute name="doClusterLog" required="false">
       <p><b>Deprecated since 6.0.0</b></p>
       <p>Possible values are <code>true</code> or <code>false</code><br/>