From edfbf1d0112bd7a134220c98f53089e8d5128f67 Mon Sep 17 00:00:00 2001
From: fhanik
Date: Fri, 4 Jul 2008 21:30:31 +0000
Subject: [PATCH] Add in startup options to the cluster channel. Document the
multicast recovery options
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@674125 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/catalina/ha/tcp/SimpleTcpCluster.java | 14 ++++++++++++--
webapps/docs/config/cluster-membership.xml | 22 ++++++++++++++++++++++
webapps/docs/config/cluster-sender.xml | 11 +++++++----
webapps/docs/config/cluster.xml | 12 ++++++++++++
4 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java b/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
index 1f568ca4d..edaa1e332 100644
--- a/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
+++ b/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
@@ -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;
+ }
}
diff --git a/webapps/docs/config/cluster-membership.xml b/webapps/docs/config/cluster-membership.xml
index 1b0d80ff9..46550beba 100644
--- a/webapps/docs/config/cluster-membership.xml
+++ b/webapps/docs/config/cluster-membership.xml
@@ -125,6 +125,28 @@
If a value smaller or equal to 0 is presented, the code will default this value to frequency
+
+
+ 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.
+ The default is true.
+
+
+
+
+ When recoveryEnabled==true this value indicates how many times we will try recovery.
+ The default is 10.
+
+
+
+
+ When recoveryEnabled==true 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 5000 (5 seconds).
+
+
diff --git a/webapps/docs/config/cluster-sender.xml b/webapps/docs/config/cluster-sender.xml
index fe82c98c9..f7fdccd84 100644
--- a/webapps/docs/config/cluster-sender.xml
+++ b/webapps/docs/config/cluster-sender.xml
@@ -98,10 +98,10 @@
The send buffer size on the datagram socket.
Default value is 43800 bytes.
-
+
Possible values are true or false.
- Set to true if you want the receiver to use direct bytebuffers when reading data
- from the sockets. Default value is false
+ Set to true if you want the receiver to use direct bytebuffers when writing data
+ to the sockets. Default value is false
The number of requests that can go through the socket before the socket is closed, and reopened
@@ -113,7 +113,10 @@
Sets the SO_TIMEOUT option on the socket. The value is in milliseconds and the default value is 3000
- 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.
+ A timeout will not spawn a retry attempt, in order to guarantee the return of the application thread.
How many times do we retry a failed message, that received a IOException at the socket level.
diff --git a/webapps/docs/config/cluster.xml b/webapps/docs/config/cluster.xml
index 5022205af..acbbfccf5 100644
--- a/webapps/docs/config/cluster.xml
+++ b/webapps/docs/config/cluster.xml
@@ -124,6 +124,18 @@
So to use ACK and ASYNC messaging, the flag would be 10 (8+2) or 0x000B
+
+
Sets the start and stop flags for the <Channel> object used by the cluster.
+ The default is Channel.DEFAULT which starts all the channel services, such as
+ sender, receiver, multicast sender and multicast receiver.
+ The following flags are available today:
+
+ Channel.DEFAULT = Channel.SND_RX_SEQ (1)| Channel.SND_TX_SEQ (2)| Channel.MBR_RX_SEQ (4)| Channel.MBR_TX_SEQ (8);
+
+ To start a channel without multicasting, you would want to use the value Channel.SND_RX_SEQ | Channel.SND_TX_SEQ
+ that equals to 3.
+
+
Enable this flag don't forget to disable the channel heartbeat thread.
--
2.11.0