Bug 53529 - Call interrupt() after InterruptedException instead interrupted()
Summary: Call interrupt() after InterruptedException instead interrupted()
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-10 11:27 UTC by F.Arnoud
Modified: 2012-07-27 23:14 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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