Worker executor adjustments

- Reset the notify_timeout on start (to ensure that the
  notification thread will continue working on repeated
  stops/starts)
- Adjust comment of stop/start method to reflect that more
  than just the proxy thread is started and stopped.

Fixes bug 1300373

Change-Id: I534fa87d9f3b9cfd7aa553f157cb7e776a08f54f
This commit is contained in:
Joshua Harlow
2014-03-29 17:14:25 -07:00
committed by Joshua Harlow
parent 5048dfc2a9
commit 0498a48e8f

View File

@@ -190,16 +190,19 @@ class WorkerTaskExecutor(executor.TaskExecutorBase):
return async_utils.wait_for_any(fs, timeout)
def start(self):
"""Start proxy thread."""
"""Start proxy thread (and associated topic notification thread)."""
if self._proxy_thread is None:
self._proxy_thread = self._make_thread(self._proxy.start)
self._proxy_thread.start()
self._proxy.wait()
self._notify_timeout.reset()
self._notify_thread = self._make_thread(self._notify_topics)
self._notify_thread.start()
def stop(self):
"""Stop proxy, so its thread would be gracefully terminated."""
"""Stop proxy thread (and associated topic notification thread), so
those threads will be gracefully terminated.
"""
if self._proxy_thread is not None:
if self._proxy_thread.is_alive():
self._notify_timeout.interrupt()