tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keiichi Fujino <kfuj...@apache.org>
Subject Re: svn commit: r1387073 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java webapps/docs/changelog.xml webapps/docs/config/cluster-interceptor.xml
Date Wed, 19 Sep 2012 08:47:05 GMT
2012/9/18 Konstantin Kolinko <knst.kolinko@gmail.com>:
> 2012/9/18  <kfujino@apache.org>:
>> Author: kfujino
>> Date: Tue Sep 18 09:45:17 2012
>> New Revision: 1387073
>>
>> URL: http://svn.apache.org/viewvc?rev=1387073&view=rev
>> Log:
>> Fix a behavior of TcpPingInterceptor#useThread.
>> If set to false, ping thread is never started.
>>
>> Modified:
>>     tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.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/TcpPingInterceptor.java
>> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java?rev=1387073&r1=1387072&r2=1387073&view=diff
>> ==============================================================================
>> --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
(original)
>> +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
Tue Sep 18 09:45:17 2012
>> @@ -64,8 +64,8 @@ public class TcpPingInterceptor extends
>>      @Override
>>      public synchronized void start(int svc) throws ChannelException {
>>          super.start(svc);
>> -        running = true;
>> -        if ( thread == null ) {
>> +        if ( thread == null && useThread) {
>> +            running = true;
>>              thread = new PingThread();
>>              thread.setDaemon(true);
>>              thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
>> @@ -86,9 +86,11 @@ public class TcpPingInterceptor extends
>>
>>      @Override
>>      public void stop(int svc) throws ChannelException {
>> -        running = false;
>> -        if ( thread != null ) thread.interrupt();
>> -        thread = null;
>> +        if ( thread != null ) {
>> +            running = false;
>> +            thread.interrupt();
>> +            thread = null;
>> +        }
>>          super.stop(svc);
>>      }
>
> The above changes the meaning of the "running" flag.
>
> IMHO, the flag is supposed to say whether TcpPingInterceptor itself is
> running or not. It does not matter whether you started a thread or
> not.  So I would move it out of the "if" block.
>
>

Done.

Thanks for the review.


> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>



-- 
Keiichi.Fujino

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message