More NPE avoidance.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 26 Sep 2010 22:50:30 +0000 (22:50 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 26 Sep 2010 22:50:30 +0000 (22:50 +0000)
Keep process methods aligned.

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

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

index 887b5a0..6d5dc61 100644 (file)
@@ -508,11 +508,10 @@ public class JIoEndpoint extends AbstractEndpoint {
             SocketWrapper<Socket> wrapper = new SocketWrapper<Socket>(socket);
             wrapper.setKeepAliveLeft(getMaxKeepAliveRequests());
             // During shutdown, executor may be null - avoid NPE
-            if (running) {
-                getExecutor().execute(new SocketProcessor(wrapper));
-                return true;
+            if (!running) {
+                return false;
             }
-            return false;
+            getExecutor().execute(new SocketProcessor(wrapper));
         } catch (RejectedExecutionException x) {
             log.warn("Socket processing request was rejected for:"+socket,x);
             return false;
@@ -522,6 +521,7 @@ public class JIoEndpoint extends AbstractEndpoint {
             log.error(sm.getString("endpoint.process.fail"), t);
             return false;
         }
+        return true;
     }
     
     
@@ -553,6 +553,10 @@ public class JIoEndpoint extends AbstractEndpoint {
                         Thread.currentThread().setContextClassLoader(
                                 getClass().getClassLoader());
                     }
+                    // During shutdown, executor may be null - avoid NPE
+                    if (!running) {
+                        return false;
+                    }
                     getExecutor().execute(proc);
                 }finally {
                     if (Globals.IS_SECURITY_ENABLED) {