Dan, I didn't see the additional check I did in Runners.run to make sure we
don't end up trying to call con.run() on
a null Connection.  This could happen if a Runner is in run on wait, and
gets the interrupt from G.interrupt();  Instead of getting from
Runners.handle()'s call to notify (which instantiates a new Con).
To prevent this, I added a check in the Runners.run()  while (runners &&
....)

ash
oh, btw thanks.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 9:57 AM
To: [EMAIL PROTECTED]
Subject: cvs commit: xml-rpc/src/java/org/apache/xmlrpc WebServer.java


dlr         02/02/21 09:57:14

  Modified:    src/java/org/apache/xmlrpc WebServer.java
  Log:
  Implemented shutdown() fixes proposed by Ashley L Raiteri
  <[EMAIL PROTECTED]> in
  <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6593>.
  
  Revision  Changes    Path
  1.6       +25 -0     xml-rpc/src/java/org/apache/xmlrpc/WebServer.java
  
  Index: WebServer.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/WebServer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- WebServer.java    19 Feb 2002 02:25:01 -0000      1.5
  +++ WebServer.java    21 Feb 2002 17:57:14 -0000      1.6
  @@ -363,12 +363,29 @@
         */
       public void shutdown()
       {
  +        // Stop accepting client connections
           if (listener != null)
           {
               Thread l = listener;
               listener = null;
               l.interrupt ();
           }
  +
  +        // Shutdown our Runner threads
  +        if (runners != null)
  +        {
  +            ThreadGroup g = runners;
  +            runners = null;
  +            try
  +            {
  +                g.interrupt();
  +            }
  +            catch (Exception e)
  +            {
  +                System.err.println(e);
  +                e.printStackTrace();
  +            }
  +        }
       }
   
       protected Runner getRunner()
  @@ -392,12 +409,20 @@
           threadpool.push (runner);
       }
   
  +    /**
  +     * Responsible for handling client connections.
  +     */
       class Runner implements Runnable
       {
           Thread thread;
           Connection con;
           int count;
   
  +        /**
  +         * Handles the client connection on <code>socket</code>.
  +         *
  +         * @param socket The source to read the client's request from.
  +         */
           public synchronized void handle(Socket socket)
               throws IOException
           {
  
  
  

Reply via email to