Author: markt
Date: Sun Jun 2 21:14:29 2013
New Revision: 1488793
URL: http://svn.apache.org/r1488793
Log:
Better handling of socket close as there might be multiple threads working with
the socket
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1488793&r1=1488792&r2=1488793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Sun Jun 2
21:14:29 2013
@@ -830,7 +830,10 @@ public class AprEndpoint extends Abstrac
} else {
SocketWrapper<Long> wrapper =
connections.get(Long.valueOf(socket));
- executor.execute(new SocketProcessor(wrapper, status));
+ // Make sure connection hasn't been closed
+ if (wrapper != null) {
+ executor.execute(new SocketProcessor(wrapper, status));
+ }
}
} catch (RejectedExecutionException x) {
log.warn("Socket processing request was rejected for:"+socket,x);
@@ -2238,10 +2241,15 @@ public class AprEndpoint extends Abstrac
private void doRun() {
// Process the request from this socket
+ if (socket.getSocket() == null) {
+ // Closed in another thread
+ return;
+ }
SocketState state = handler.process(socket, status);
if (state == Handler.SocketState.CLOSED) {
// Close socket and pool
destroySocket(socket.getSocket().longValue());
+ socket.socket = null;
} else if (state == Handler.SocketState.LONG) {
socket.access();
if (socket.async) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]