Add in startup options to the cluster channel.
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 4 Jul 2008 21:30:31 +0000 (21:30 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 4 Jul 2008 21:30:31 +0000 (21:30 +0000)
Document the multicast recovery options

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

java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
webapps/docs/config/cluster-membership.xml
webapps/docs/config/cluster-sender.xml
webapps/docs/config/cluster.xml

index 1f568ca..edaa1e3 100644 (file)
@@ -179,6 +179,8 @@ public class SimpleTcpCluster
     private Map properties = new HashMap();
     
     private int channelSendOptions = Channel.SEND_OPTIONS_ASYNCHRONOUS;
+    
+    private int channelStartOptions = Channel.DEFAULT;
 
     // ------------------------------------------------------------- Properties
 
@@ -673,7 +675,7 @@ public class SimpleTcpCluster
             registerClusterValve();
             channel.addMembershipListener(this);
             channel.addChannelListener(this);
-            channel.start(channel.DEFAULT);
+            channel.start(channelStartOptions);
             if (clusterDeployer != null) clusterDeployer.start();
             this.started = true;
             //register JMX objects
@@ -769,7 +771,7 @@ public class SimpleTcpCluster
         this.managers.clear();
         try {
             if ( clusterDeployer != null ) clusterDeployer.setCluster(null);
-            channel.stop(Channel.DEFAULT);
+            channel.stop(channelStartOptions);
             channel.removeChannelListener(this);
             channel.removeMembershipListener(this);
             this.unregisterClusterValve();
@@ -951,4 +953,12 @@ public class SimpleTcpCluster
     public String getProtocol() {
         return null;
     }
+
+    public int getChannelStartOptions() {
+        return channelStartOptions;
+    }
+
+    public void setChannelStartOptions(int channelStartOptions) {
+        this.channelStartOptions = channelStartOptions;
+    }
 }
index 1b0d80f..46550be 100644 (file)
       If a value smaller or equal to 0 is presented, the code will default this value to frequency
       </p>
     </attribute>
+    <attribute name="recoveryEnabled" required="false">
+      <p>
+      In case of a network failure, Java multicast socket don't transparently fail over, instead the socket will continously
+      throw IOException upon each receive request. When recoveryEnabled is set to true, this will close the multicast socket
+      and open a new socket with the same properties as defined above.<br/>
+      The default is <code>true</code>. <br/>
+      </p>
+    </attribute>
+    <attribute name="recoveryCounter" required="false">
+      <p>
+      When <code>recoveryEnabled==true</code> this value indicates how many times we will try recovery.
+      The default is <code>10</code>. <br/>
+      </p>
+    </attribute>
+    <attribute name="recoverySleepTime" required="false">
+      <p>
+      When <code>recoveryEnabled==true</code> this value indicates how long time (in milliseconds)
+      the system will sleep in between recovery attempts, until we either recovered successfully or we have reached the
+      recoveryCounter limit.
+      The default is <code>5000</code> (5 seconds). <br/>
+      </p>
+    </attribute>
 
 
   </attributes>
index fe82c98..f7fdccd 100644 (file)
        The send buffer size on the datagram socket.
        Default value is <code>43800</code> bytes.
       </attribute>
-      <attribute name="direct" required="false">
+      <attribute name="directBuffer" required="false">
        Possible values are <code>true</code> or <code>false</code>. 
-       Set to true if you want the receiver to use direct bytebuffers when reading data
-       from the sockets. Default value is <code>false</code>
+       Set to true if you want the receiver to use direct bytebuffers when writing data
+       to the sockets. Default value is <code>false</code>
       </attribute>
       <attribute name="keepAliveCount" required="false">
        The number of requests that can go through the socket before the socket is closed, and reopened
       </attribute>
       <attribute name="timeout" required="false">
         Sets the SO_TIMEOUT option on the socket. The value is in milliseconds and the default value is <code>3000</code> 
-        milliseconds.
+        milliseconds.(3 seconds) This timeout starts when a message send attempt is starting, until the transfer has been completed.
+        For the NIO sockets, this will mean, that the caller can guarantee that we will not attempt sending the message
+        longer than this timeout value. For the blocking IO implementation, this translated directly to the soTimeout.<br/>
+        A timeout will not spawn a retry attempt, in order to guarantee the return of the application thread.
       </attribute>
       <attribute name="maxRetryAttempts" required="false">
         How many times do we retry a failed message, that received a IOException at the socket level.
index 5022205..acbbfcc 100644 (file)
       So to use ACK and ASYNC messaging, the flag would be <code>10 (8+2) or 0x000B</code><br/>
       </p>
     </attribute>
+    <attribute name="channelStartOptions" required="false">
+      <p>Sets the start and stop flags for the &lt;Channel&gt; object used by the cluster.
+         The default is <code>Channel.DEFAULT</code> which starts all the channel services, such as 
+         sender, receiver, multicast sender and multicast receiver.
+         The following flags are available today:
+         <source>
+           Channel.DEFAULT = Channel.SND_RX_SEQ (1)| Channel.SND_TX_SEQ (2)| Channel.MBR_RX_SEQ (4)| Channel.MBR_TX_SEQ (8);
+         </source>
+         To start a channel without multicasting, you would want to use the value <code>Channel.SND_RX_SEQ | Channel.SND_TX_SEQ</code>
+         that equals to <code>3</code>.
+      </p>
+    </attribute>
 
     <attribute name="heartbeatBackgroundEnabled" required="false">
       <p>Enable this flag don't forget to disable the channel heartbeat thread.