Dan,
yeah, It i think you are right about the listen coming first.
Although it doesn't "really matter" because we've anihalated the runner's
threadgroup,
and a call to runner.handle would repeatedly generate an exception that
would be caught by the catch (IOException)
in Webserver's run try block, until listenr = null, which would happen soon
afterwards.
but obvisouly, it would be nicer to prevent exceptions than just handle
them.
The only thing I am still not clear on is whether or not the pointers on the
Stack threadpool
need to be deleted/handled...
ashley raiteri

ps. thanks for the all the work you've been doing lately, we might even
consider doing a new build and download tar
with the frenzy of activity in the last week.



-----Original Message-----
From: Daniel Rall [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 1:40 PM
To: XML-RPC Development
Subject: 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++;

Reply via email to