You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by Daniel Rall <dl...@finemaltcoding.com> on 2002/02/20 22:40:28 UTC

WebServer shutdown

Ashley, shouldn't the listener thread be shut down before the runners
so that the server doesn't accept more connections which it can't
process?  Other than that, this looks good to me.  Anyone else have
any comments?


---Webserver.java 
+++Webserver.java 
@@ -351,7 +351,11 @@
             {
                 serverSocket.close();
                 serverSocket = null;
-            }
+                listener = null;
+                runners = null;
+                keepalive = false;
+            }
              catch (IOException ignore)
              {
              }
@@ -363,7 +367,21 @@
     {
-         if (listener != null)
+         if (runners)
+         {
+           ThreadGroup R = runners;
+           runners = null;
+           try {
+               R.interrupt();          
+           }
+           catch (Exception ex)
+           {
+               System.err.println (ex);
+               ex.printStackTrace();
+           }
+        }    
+        if (listener != null)
         {
            Thread l = listener;
            listener = null;
@@ -416,7 +434,7 @@

         public void run ()
         {
-            while (Thread.currentThread() == thread)
+            while (runners && (Thread.currentThread() == thread))
             {
                 con.run ();
                 count++;