Author: markt
Date: Wed Aug 9 11:53:36 2017
New Revision: 1804507
URL: http://svn.apache.org/viewvc?rev=1804507&view=rev
Log:
Try and avoid shutdown exceptions
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java?rev=1804507&r1=1804506&r2=1804507&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Wed
Aug 9 11:53:36 2017
@@ -328,13 +328,20 @@ public class NioBlockingSelector {
}
}
events.clear();
- try {
- selector.selectNow();//cancel all remaining keys
- }catch( Exception ignore ) {
- if (log.isDebugEnabled())log.debug("",ignore);
+ // If using a shared selector, the NioSelectorPool will also try
and
+ // close the selector. Try and avoid the ClosedSelectorException
+ // although because multiple threads are involved there is always
+ // the possibility of an Exception here.
+ if (selector.isOpen()) {
+ try {
+ // Cancels all remaining keys
+ selector.selectNow();
+ }catch( Exception ignore ) {
+ if (log.isDebugEnabled())log.debug("",ignore);
+ }
}
try {
- selector.close();//Close the connector
+ selector.close();
}catch( Exception ignore ) {
if (log.isDebugEnabled())log.debug("",ignore);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]