http server: have names at threads.
A minor improvement, http client threads have a name now. Conflicts: bin/service/http_server.py bzr revid: p_christ@hol.gr-20100726093335-0p0v34d276u0ks87
This commit is contained in:
parent
bea04e1fc8
commit
522df9e236
|
@ -74,6 +74,7 @@ class ThreadedHTTPServer(ConnThreadingMixIn, SimpleXMLRPCDispatcher, HTTPServer)
|
|||
HTTPServer.__init__(self, addr, requestHandler)
|
||||
|
||||
self.numThreads = 0
|
||||
self.__threadno = 0
|
||||
|
||||
# [Bug #1222790] If possible, set close-on-exec flag; if a
|
||||
# method spawns a subprocess, the subprocess shouldn't have
|
||||
|
@ -95,6 +96,10 @@ class ThreadedHTTPServer(ConnThreadingMixIn, SimpleXMLRPCDispatcher, HTTPServer)
|
|||
def _mark_end(self, thread):
|
||||
self.numThreads -= 1
|
||||
|
||||
|
||||
def _get_next_name(self):
|
||||
self.__threadno += 1
|
||||
return 'http-client-%d' % self.__threadno
|
||||
class HttpLogHandler:
|
||||
""" helper class for uniform log handling
|
||||
Please define self._logger at each class that is derived from this
|
||||
|
|
|
@ -439,11 +439,15 @@ class ConnThreadingMixIn:
|
|||
# main process
|
||||
daemon_threads = False
|
||||
|
||||
def _get_next_name(self):
|
||||
return None
|
||||
|
||||
def _handle_request_noblock(self):
|
||||
"""Start a new thread to process the request."""
|
||||
if not threading: # happens while quitting python
|
||||
return
|
||||
t = threading.Thread(target = self._handle_request2)
|
||||
n = self._get_next_name()
|
||||
t = threading.Thread(name=n, target = self._handle_request2)
|
||||
if self.daemon_threads:
|
||||
t.setDaemon (1)
|
||||
t.start()
|
||||
|
|
Loading…
Reference in New Issue