DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15518>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15518

shutdown uses join with listener

           Summary: shutdown uses join with listener
           Product: XML-RPC
           Version: unspecified
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Source
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


"ant test" failed with message, "Address already in use". Because
WebServer#shutdown doesn't wait for the interrupted thread. 

--- ClientServerRpcTest.java    2002/12/19 07:13:01     1.1
+++ ClientServerRpcTest.java    2002/12/19 08:39:02
@@ -171,6 +171,7 @@
             System.out.println("Starting WebServer for url space " +
                                serverURL + " ...");
             webServer = new WebServer(SERVER_PORT, localhost);
+           webServer.addHandler(HANDLER_NAME, new TestHandler());
         }
         catch (Exception e)
         {
@@ -203,7 +204,7 @@
         client = null;
         // TODO: Shut down server
         server = null;
-        webServer.shutdown();
+        webServer.shutdown(true);
         webServer = null;
         XmlRpc.setDebug(false);
     }

--- WebServer.java      2002/12/19 07:01:27     1.1
+++ WebServer.java      2002/12/19 08:38:04
@@ -363,12 +363,28 @@
       */
     public void shutdown()
     {
+       shutdown(false);
+    }
+
+    public void shutdown(boolean wait)
+    {
         // Stop accepting client connections
         if (listener != null)
         {
             Thread l = listener;
             listener = null;
             l.interrupt ();
+           if (wait)
+           {
+               try
+               {
+                   l.join();
+               }
+               catch (InterruptedException e)
+               {
+                   throw new RuntimeException(e.getMessage());
+               }
+           }
         }
 
         // Shutdown our Runner-based threads

Reply via email to