I'd have to go dig into the library code again as I haven't been in there
since I did this myself a few months ago,  but I believe you're correct. If
you inherit from ThreadingMixIn, it will create a new thread for each
incoming request.  I believe it's the same way the standard
ThreadingTCPServer/ThreadingUDPServer classes work...  It will create a new
thread for each request, there's no pooling.

The ThreadingMixIn class overrides process_request, which TCPServer will
call to handle each request. The process_request method, in turn, creates a
new instance of your handler which is responsible for the RPC dispatching.

-Jeff

On 3/29/07, Laszlo Nagy <[EMAIL PROTECTED]> wrote:

Jeff McNeil wrote:
> This is off of memory so I apologize if I don't get all of the details
right.
>
> The base SimpleXMLRPCServer uses TCPServer as it's server component
> and SimpleXMLXMLRPCRequestHandler as it's handler. The handler is a
> subclass of BaseHTTPRequestHandler, which itself doesn't handle any
> multithreading.  You need to use one of the *MixIn classes if you want
> to handle concurrent requests.
>
Does it mean that, if I subclass from ThreadingMixIn then my exported
functions will be called from different threads? I created many multi
threaded servers, based on TCPServer, but I'm not sure about
XMLRPCServer.  I used to create my own handler class and in that case, a
new handler instance was created for each request, then a new thread was
created and handle_request was called from that new thread. I guess that
in this case, a new SimpleXMLXMLRPCRequestHandler is created for each
request and a new thread is started.... but I'm not sure. Please help us
out.

By the way, we should have __server__ examples in the documentation of
xmlrpclib, right? What is the right way of contributing an example?

Best,

  Laszlo


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to