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 2013/09/30 21:34:42 UTC

svn commit: r1527738 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/net/AprEndpoint.java

Author: markt
Date: Mon Sep 30 19:34:42 2013
New Revision: 1527738

URL: http://svn.apache.org/r1527738
Log:
Add a warning comment and simplify the code a little.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1527731

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1527738&r1=1527737&r2=1527738&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Mon Sep 30 19:34:42 2013
@@ -900,16 +900,20 @@ public class AprEndpoint extends Abstrac
         Poller poller = this.poller;
         if (poller != null) {
             if (!poller.close(socket)) {
-                destroySocketInternal(socket, true);
+                destroySocketInternal(socket);
             }
         }
     }
 
-    private void destroySocketInternal(long socket, boolean doIt) {
+    /*
+     * This method should only be called if there is no chance that the socket
+     * is currently being used by the Poller.
+     */
+    private void destroySocketInternal(long socket) {
         connections.remove(Long.valueOf(socket));
         if (log.isDebugEnabled()) {
             String msg = sm.getString("endpoint.debug.destroySocket",
-                    Long.valueOf(socket), Boolean.valueOf(doIt));
+                    Long.valueOf(socket));
             if (log.isTraceEnabled()) {
                 log.trace(msg, new Exception());
             } else {
@@ -920,7 +924,7 @@ public class AprEndpoint extends Abstrac
         // twice for the same socket the JVM will core. Currently this is only
         // called from Poller.closePollset() to ensure kept alive connections
         // are closed when calling stop() followed by start().
-        if (doIt && socket != 0) {
+        if (socket != 0) {
             Socket.destroy(socket);
             countDownConnection();
         }
@@ -1410,7 +1414,7 @@ public class AprEndpoint extends Abstrac
                                 Long.valueOf(desc[n*2+1])).isComet();
                         if (!comet || (comet && !processSocket(
                                 desc[n*2+1], SocketStatus.STOP))) {
-                            destroySocketInternal(desc[n*2+1], true);
+                            destroySocketInternal(desc[n*2+1]);
                         }
                     }
                 }
@@ -1556,7 +1560,7 @@ public class AprEndpoint extends Abstrac
                         Long.valueOf(socket)).isComet();
                 if (!comet || (comet && !processSocket(
                         socket, SocketStatus.TIMEOUT))) {
-                    destroySocketInternal(socket, true);
+                    destroySocketInternal(socket);
                 }
                 socket = timeouts.check(date);
             }
@@ -1658,7 +1662,7 @@ public class AprEndpoint extends Abstrac
                         while (info != null) {
                             localAddList.remove(info.socket);
                             removeFromPoller(info.socket);
-                            destroySocketInternal(info.socket, true);
+                            destroySocketInternal(info.socket);
                             info = localCloseList.get();
                         }
                     }



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