You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/12/06 11:47:02 UTC
svn commit: r1772872 - in /tomcat/trunk/java/org/apache/tomcat/util/net:
Nio2Endpoint.java NioEndpoint.java
Author: markt
Date: Tue Dec 6 11:47:01 2016
New Revision: 1772872
URL: http://svn.apache.org/viewvc?rev=1772872&view=rev
Log:
Refactor to better align NIO and NIO2 Acceptor classes
- Re-use IOException handling during accept from NIO2 (it is slightly better)
- Align comments
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1772872&r1=1772871&r2=1772872&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Tue Dec 6 11:47:01 2016
@@ -446,7 +446,8 @@ public class Nio2Endpoint extends Abstra
// Configure the socket
if (running && !paused) {
- // Hand this socket off to an appropriate processor
+ // setSocketOptions() will hand the socket off to
+ // an appropriate processor if successful
if (!setSocketOptions(socket)) {
countDownConnection();
closeSocket(socket);
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1772872&r1=1772871&r2=1772872&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue Dec 6 11:47:01 2016
@@ -445,17 +445,22 @@ public class NioEndpoint extends Abstrac
} catch (IOException ioe) {
// We didn't get a socket
countDownConnection();
- // Introduce delay if necessary
- errorDelay = handleExceptionWithDelay(errorDelay);
- // re-throw
- throw ioe;
+ if (running) {
+ // Introduce delay if necessary
+ errorDelay = handleExceptionWithDelay(errorDelay);
+ // re-throw
+ throw ioe;
+ } else {
+ break;
+ }
}
// Successful accept, reset the error delay
errorDelay = 0;
- // setSocketOptions() will add channel to the poller
- // if successful
+ // Configure the socket
if (running && !paused) {
+ // setSocketOptions() will hand the socket off to
+ // an appropriate processor if successful
if (!setSocketOptions(socket)) {
countDownConnection();
closeSocket(socket);
@@ -466,10 +471,6 @@ public class NioEndpoint extends Abstrac
}
} catch (SocketTimeoutException sx) {
// Ignore: Normal condition
- } catch (IOException x) {
- if (running) {
- log.error(sm.getString("endpoint.accept.fail"), x);
- }
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("endpoint.accept.fail"), t);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org