Author: kfujino
Date: Thu Nov 10 06:20:03 2016
New Revision: 1769052
URL: http://svn.apache.org/viewvc?rev=1769052&view=rev
Log:
Reduce the warning logs for a message received from a different domain in order
to avoid excessive log outputs.
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/DomainFilterInterceptor.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/DomainFilterInterceptor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/DomainFilterInterceptor.java?rev=1769052&r1=1769051&r2=1769052&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/DomainFilterInterceptor.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/DomainFilterInterceptor.java
Thu Nov 10 06:20:03 2016
@@ -17,6 +17,7 @@
package org.apache.catalina.tribes.group.interceptors;
import java.util.Arrays;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.catalina.tribes.ChannelMessage;
import org.apache.catalina.tribes.Member;
@@ -40,14 +41,19 @@ public class DomainFilterInterceptor ext
protected Membership membership = null;
protected byte[] domain = new byte[0];
+ protected int logInterval = 100;
+ private final AtomicInteger logCounter = new AtomicInteger(logInterval);
@Override
public void messageReceived(ChannelMessage msg) {
if (Arrays.equals(domain, msg.getAddress().getDomain())) {
super.messageReceived(msg);
} else {
- if (log.isWarnEnabled())
- log.warn("Received message from cluster["+msg.getAddress()+"]
was refused.");
+ if (logCounter.incrementAndGet() >= logInterval) {
+ logCounter.set(0);
+ if (log.isWarnEnabled())
+ log.warn("Received message from
cluster["+msg.getAddress()+"] was refused.");
+ }
}
}//messageReceived
@@ -125,4 +131,12 @@ public class DomainFilterInterceptor ext
setDomain(org.apache.catalina.tribes.util.Arrays.convert(domain));
}
+ public int getLogInterval() {
+ return logInterval;
+ }
+
+ public void setLogInterval(int logInterval) {
+ this.logInterval = logInterval;
+ }
+
}
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=1769052&r1=1769051&r2=1769052&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Nov 10 06:20:03 2016
@@ -58,6 +58,14 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 7.0.74 (violetagg)">
+ <subsection name="Tribes">
+ <changelog>
+ <fix>
+ Reduce the warning logs for a message received from a different domain
+ in order to avoid excessive log outputs. (kfujino)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="Tomcat 7.0.73 (violetagg)">
<subsection name="Catalina">
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=1769052&r1=1769051&r2=1769052&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 Thu Nov 10
06:20:03 2016
@@ -103,6 +103,10 @@
using ISO-8859-1 encoding.<br/>
2. byte array in string form, for example {216,123,12,3}<br/>
</attribute>
+ <attribute name="logInterval" required="false">
+ This value indicates the interval for logging for messages from
different domains.
+ The default is 100, which means that to log per 100 messages.
+ </attribute>
</attributes>
</subsection>
<subsection
name="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor
Attributes">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]