Stanislav Miklik wrote:

I have probably found a bug in WebServer.shutdown().
This call has frozen, but I don't know why.
Conditions that might affecting this:
1. I started the server with enabled extensions and enabled keepalive
(others default, if not mentioned)
2. In the same program (in another thread of course) I create client
connected to this server with enabled extensions
3. this client sends in loop requests to server (delayed for 2 seconds)
4. then I called shutdown on the server (e.g. after 10 seconds)

When I try to debug it, my debugger (Eclipse) freeze on command
pool.shutdown(); in method shutdown().

Hopefully this description will help.

Following your description, I have written the small test program below. It works fine for me.


Jochen


package org.apache.xmlrpc.test;

import java.net.URL;

import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.webserver.WebServer;

import junit.framework.TestCase;


/** Tests the web servers shutdown feature.
 */
public class ShutdownTest extends TestCase {
    public static class Adder {
        public int add(int p1, int p2) {
            return p1 + p2;
        }
    }

    private WebServer setupServer() throws Exception {
        WebServer server = new WebServer(0);
        PropertyHandlerMapping mapping = new PropertyHandlerMapping();
        mapping.addHandler("Adder", Adder.class);
        server.getXmlRpcServer().setHandlerMapping(mapping);
        server.start();
        return server;
    }

    public void testShutdown() throws Exception {
        final WebServer server = setupServer();
        int port = server.getPort();
        XmlRpcClient client = new XmlRpcClient();
        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
        config.setServerURL(new URL("http://127.0.0.1:"; + port + "/"));
        client.setConfig(config);
        for (int i = 0;  i < 10;  i++) {
Integer result = (Integer) client.execute("Adder.add", new Object[]{ new Integer(3), new Integer(5) });
            assertEquals(8, result.intValue());
            Thread.sleep(2000);
        }
        server.shutdown();
    }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to