Author: kfujino
Date: Wed Jun 5 09:09:46 2013
New Revision: 1489755
URL: http://svn.apache.org/r1489755
Log:
Add removeSuspectsTimeout attribute in order to dispel remove suspect.
The removeSuspects members never be removed until disappeared really.
Remove members that worked properly specified time by removeSuspectsTimeout
from removeSuspects.
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-interceptor.xml
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java?rev=1489755&r1=1489754&r2=1489755&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
Wed Jun 5 09:09:46 2013
@@ -83,7 +83,9 @@ public class TcpFailureDetector extends
protected HashMap<Member, Long> removeSuspects = new HashMap<Member,
Long>();
protected HashMap<Member, Long> addSuspects = new HashMap<Member, Long>();
-
+
+ protected int removeSuspectsTimeout = 300; // 5 minutes
+
@Override
public void sendMessage(Member[] destination, ChannelMessage msg,
InterceptorPayload payload) throws ChannelException {
try {
@@ -272,7 +274,15 @@ public class TcpFailureDetector extends
removeSuspects.remove(m);
if(log.isInfoEnabled())
log.info("Suspect member, confirmed dead.["+m+"]");
- } //end if
+ } else {
+ if (removeSuspectsTimeout > 0) {
+ long timeNow = System.currentTimeMillis();
+ int timeIdle = (int) ((timeNow - removeSuspects.get(m)) /
1000L);
+ if (timeIdle > removeSuspectsTimeout) {
+ removeSuspects.remove(m); // remove suspect member
+ }
+ }
+ }
}
//check add suspects members if they are alive now,
@@ -363,6 +373,10 @@ public class TcpFailureDetector extends
return connectTimeout;
}
+ public int getRemoveSuspectsTimeout() {
+ return removeSuspectsTimeout;
+ }
+
public void setPerformConnectTest(boolean performConnectTest) {
this.performConnectTest = performConnectTest;
}
@@ -383,4 +397,8 @@ public class TcpFailureDetector extends
this.connectTimeout = connectTimeout;
}
+ public void setRemoveSuspectsTimeout(int removeSuspectsTimeout) {
+ this.removeSuspectsTimeout = removeSuspectsTimeout;
+ }
+
}
\ No newline at end of file
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1489755&r1=1489754&r2=1489755&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Jun 5 09:09:46 2013
@@ -181,6 +181,10 @@
Improve error message by including specified timeout if failed to
retrieve a data sender. (kfujino)
</add>
+ <add>
+ Add <code>removeSuspectsTimeout</code> attribute in order to remove a
+ suspect node in TcpFailureDetector. (kfujino)
+ </add>
</changelog>
</subsection>
<subsection name="Web applications">
Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-interceptor.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-interceptor.xml?rev=1489755&r1=1489754&r2=1489755&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-interceptor.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-interceptor.xml Wed Jun 5
09:09:46 2013
@@ -157,6 +157,13 @@
Specifies the timeout, in milliseconds, to use when performing a read
test
to the suspicious node. Default is 5000.
</attribute>
+ <attribute name="removeSuspectsTimeout" required="false">
+ The maximum time(in seconds) for remove from removeSuspects. Member of
+ removeSuspects will be automatically removed after
removeSuspectsTimeout.
+ If a negative value specified, the removeSuspects members never be
+ removed until disappeared really. If the attribute is not provided,
+ a default of 300 milliseconds (5 minutes) is used.
+ </attribute>
</attributes>
</subsection>
<subsection
name="org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor
Attributes">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]