ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dari0 <>
Subject [XML-RPC Apache] The api create request handler for each request! HELP
Date Wed, 06 Jul 2011 11:21:20 GMT

Hi all, 
I am trying to set up a XML RPC server using the apache API. Initially I
followed the following example
 about how to set up a simple client-server for exchanging XML RPC request
and response. The example we are talking about is the "calculator" simple
Once the server is set up, the client just execute the request like 

Integer result = (Integer) client.execute("Calculator.add", params);

and get the reply back.
So far, so good.
The problem is the following: the server create an instance of the
calculator object EACH TIME A REQUEST ARRIVE TO THE SERVER. This is not
suitable for my purposes, as the matter of the fact I have a big slow class,
that performs lots of operations when creating the object. For this reason
this solution is not suitable for me. For giving you an idea I modified the
Calculator class as follows:

public class Calculator {

    public Calculator() {
        try {
        } catch (InterruptedException ex) {
null, ex);

    public int add(int i1, int i2) {

        return i1 + i2;


    public int subtract(int i1, int i2) {

        return i1 - i2;


and in this case the response take up to 10 second to be computed....  This
is not good for me...  what can I do to solve this problem? At the moment I
am trying to modify XmlRpcServlet and XmlRpcServletServer source code, but I
am sure there is a more straightforward solution for this...  is there a way
to keep the calculator obj always alive somewhere for handling the requests?
PLEASE HELP! I really appreciate your help. 
Many thanks
View this message in context:
Sent from the Apache Xml-RPC - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message