opensubscriber
   Find in this group all groups
 
Unknown more information…

r : rpc-user@xml.apache.org 19 February 2005 • 7:42AM -0500

Re: jetty with XML-RPC
by Adam Taft

REPLY TO AUTHOR
 
REPLY TO GROUP






Massive Boisson wrote:
> 1. Now it opens a new thread for every incomming request?
> --> (Yes it opens new thread for every incomming request)

Yes, every incoming request spawns a new thread in WebServer.

> 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?)

This obviously has some implications on threading, since potentially
multiple threads can have the same handler object at any given time.
Local class variables of MyHandler would need to be synchronized,
created as a ThreadLocal, or some other technique if you need to write
to them.  Otherwise you risk having another thread (ie. another incoming
request) change the state of your handler unexpectedly.

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

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