Bug 53529

Summary: Call interrupt() after InterruptedException instead interrupted()
Product: Tomcat 7 Reporter: F.Arnoud <frederic.arnoud>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: frederic.arnoud
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description F.Arnoud 2012-07-10 11:27:42 UTC
In class:

org\apache\catalina\tribes\group\GroupChannel.java
    line 692
org\apache\catalina\tribes\group\interceptors\NonBlockingCoordinator.java
    line 228
org\apache\catalina\tribes\group\interceptors\TcpPingInterceptor.java
    line 173
org\apache\catalina\tribes\membership\McastServiceImpl.java
    line 542
org\apache\juli\AsyncFileHandler.java
    line 124
    line 146
org\apache\tomcat\util\net\AprEndpoint.java
    line 640
org\apache\tomcat\util\net\NioBlockingSelector.java
    line 112
    line 177
org\apache\tomcat\util\threads\ThreadPoolExecutor.java
    line 187


Affect 7.0.29 (and previous release) but affect also Tomcat 6.
Comment 1 Mark Thomas 2012-07-27 23:14:02 UTC
Not one of these was a valid bug. There was scope to remove some unnecessary code and improve some log messages a little which is the only reason this wasn't closed as invalid. I have said this before and I'll say it again. Before reporting something as a bug because it looks like a typical bug pattern, please do the Tomcat committers the courtesy of actually analyzing the code to see if there really is a problem. 

The only issue that came close to the original bug report was:
org\apache\catalina\tribes\group\interceptors\NonBlockingCoordinator.java
line 228
For this issue there was a marginal benefit to re-setting the interrupt flag and clearing it later as it allowed a specific error message to be generated in the unlikely event that there was an interrupt. This has been fixed in trunk (for 8.0.x) and I see no need to back-port the change.

The following were all unnecessary attempts to clear the interrupt flag and continue. The attempt is unnecessary since throwing InterruptedException clears the interrupt flag. I have fixed these in trunk but I see no need to back-port the changes.
org\apache\catalina\tribes\group\GroupChannel.java
line 692
org\apache\catalina\tribes\group\interceptors\TcpPingInterceptor.java
line 173
org\apache\juli\AsyncFileHandler.java
line 124
line 146
org\apache\tomcat\util\net\AprEndpoint.java
line 640
org\apache\tomcat\util\net\NioBlockingSelector.java
line 112
line 177
org\apache\tomcat\util\threads\ThreadPoolExecutor.java
line 187

The following was an unnecessary attempt to catch InterruptedException when it is not thrown. This have been removed from trunk but I see no need to back-port the change.
org\apache\catalina\tribes\membership\McastServiceImpl.java
line 542