tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1746501 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Date Wed, 01 Jun 2016 21:37:12 GMT
Author: markt
Date: Wed Jun  1 21:37:12 2016
New Revision: 1746501

URL: http://svn.apache.org/viewvc?rev=1746501&view=rev
Log:
Make processSocket() more like NIO/NIO2

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=1746501&r1=1746500&r2=1746501&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Jun  1 21:37:12 2016
@@ -804,24 +804,24 @@ public class AprEndpoint extends Abstrac
      *         <code>false</code> which indicates an error occurred and that
the
      *         socket should be closed
      */
-    public boolean processSocket(long socket, SocketEvent event) {
+    protected boolean processSocket(long socket, SocketEvent event) {
         SocketWrapperBase<Long> socketWrapper = connections.get(Long.valueOf(socket));
-        if (socketWrapper != null) {
-            return processSocket(socketWrapper, event, true);
-        }
-        return true;
+        return processSocket(socketWrapper, event, true);
     }
 
 
     @Override
-    public boolean processSocket(SocketWrapperBase<Long> socket, SocketEvent event,
-            boolean dispatch) {
+    public boolean processSocket(SocketWrapperBase<Long> socketWrapper,
+            SocketEvent event, boolean dispatch) {
         try {
+            if (socketWrapper == null) {
+                return false;
+            }
             // Synchronisation is required here as this code may be called as a
             // result of calling AsyncContext.dispatch() from a non-container
             // thread
-            synchronized (socket) {
-                SocketProcessor proc = new SocketProcessor(socket, event);
+            synchronized (socketWrapper) {
+                SocketProcessor proc = new SocketProcessor(socketWrapper, event);
                 Executor executor = getExecutor();
                 if (dispatch && executor != null) {
                     executor.execute(proc);
@@ -830,7 +830,7 @@ public class AprEndpoint extends Abstrac
                 }
             }
         } catch (RejectedExecutionException ree) {
-            log.warn(sm.getString("endpoint.executor.fail", socket) , ree);
+            log.warn(sm.getString("endpoint.executor.fail", socketWrapper) , ree);
             return false;
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message