Code clean-up
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 18 Sep 2010 11:53:19 +0000 (11:53 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 18 Sep 2010 11:53:19 +0000 (11:53 +0000)
Align end-point behaviours. Should then be easier to apply async chnages.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@998446 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/JIoEndpoint.java
java/org/apache/tomcat/util/net/NioEndpoint.java

index 8371449..2200c9d 100644 (file)
@@ -180,8 +180,11 @@ public class JIoEndpoint extends AbstractEndpoint {
                     }
                 }
 
-                // Accept the next incoming connection from the server socket
+                if (!running) {
+                    break;
+                }
                 try {
+                    // Accept the next incoming connection from the server socket
                     Socket socket = serverSocketFactory.acceptSocket(serverSocket);
                     serverSocketFactory.initSocket(socket);
                     // Hand this socket off to an appropriate processor
index 5d6d628..2f2c9a1 100644 (file)
@@ -761,8 +761,10 @@ public class NioEndpoint extends AbstractEndpoint {
          */
         @Override
         public void run() {
+            
             // Loop until we receive a shutdown command
             while (running) {
+                
                 // Loop if endpoint is paused
                 while (paused && running) {
                     try {
@@ -771,6 +773,10 @@ public class NioEndpoint extends AbstractEndpoint {
                         // Ignore
                     }
                 }
+
+                if (!running) {
+                    break;
+                }
                 try {
                     // Accept the next incoming connection from the server socket
                     SocketChannel socket = serverSock.accept();