opensubscriber
   Find in this group all groups
 
Unknown more information…

x : xmlrpc-user@ws.apache.org 21 February 2005 • 8:48PM -0500

Re: jetty with XML-RPC
by Paolo Campanella

REPLY TO AUTHOR
 
REPLY TO GROUP




On Mon, 2005-02-21 at 11:20, Massive Boisson wrote:
> > > 2. But does it use one instance of myHandler, or does it create new instance
> > > of myHandler for every request?
> > > --> (It creates new instance of myHandler for every request)
> >
> > No, I believe that only one instance of the class used as a handler is
> > instantiated.  That is:
> >
> >    server.addHandler("some.name", new MyHandler());
> >
> > will only create one MyHandler object and keep it around for incoming
> > requests, not one seperate instance for each incoming request.  (Can
> > someone verify this?)
>
> Well, I decided to stop being lazy and created a simple test with
> variable in MyHandler (this was NOT a static var). Anyway I had it
> increase with every call, and quickly it became obvious that indeed
> you are rigth - it uses one instance - it's singleton.

To be really sure, you should make your servlet slow (put in a sleep
statement). Or else, you would really have to test it under high load:
if Jetty's maintaining a pool of handlers (the typical behaviour I
believe; certainly the case in my own configuration) and the servlet
executes too quickly, it can _appear_ to have just one handler.


Bye

Paolo


Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.