ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wiedmann <jochen.wiedm...@gmail.com>
Subject Re: [XML-RPC Apache] The api create request handler for each request! HELP
Date Wed, 06 Jul 2011 11:56:57 GMT
http://ws.apache.org/xmlrpc/handlerCreation.html


On Wed, Jul 6, 2011 at 1:21 PM, dari0 <dbernaa@essex.ac.uk> wrote:
>
> Hi all,
> I am trying to set up a XML RPC server using the apache API. Initially I
> followed the following example
> http://ws.apache.org/xmlrpc/client.html
>  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
> example.
> 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:
>
> [CODE]
> public class Calculator {
>
>    public Calculator() {
>        try {
>            Thread.sleep(10000);
>        } catch (InterruptedException ex) {
>            Logger.getLogger(Calculator.class.getName()).log(Level.SEVERE,
> null, ex);
>        }
>    }
>
>    public int add(int i1, int i2) {
>
>        return i1 + i2;
>
>    }
>
>    public int subtract(int i1, int i2) {
>
>        return i1 - i2;
>
> [/CODE]
>
>
> 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
>  Dario
> --
> View this message in context: http://old.nabble.com/-XML-RPC-Apache--The-api-create-request-handler-for-each-request%21-HELP-tp32004135p32004135.html
> Sent from the Apache Xml-RPC - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: dev-help@ws.apache.org
>
>



-- 
Capitalism is the astounding belief that the most wickedest of men
will do the most wickedest of things for the greatest good of
everyone.

John Maynard Keynes (http://en.wikiquote.org/wiki/Keynes)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


Mime
View raw message