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
{