support ability to set thread pool size per listener

it'd be nice to support listeners with different threading
requirements.

e.g. 1 listener that pulls from a queue with no ordering requirements,
therefore, able to handle multiple threads. another listener that
pulls from queue with sequential requirements, therefore, requires
a single thread process all data, in order.

Change-Id: Id3af696193af2ccf5e5f3a1ae1d22f4f80860606
This commit is contained in:
gordon chung 2016-02-02 18:05:32 -05:00
parent 11d7c44a36
commit bac3969929

View File

@ -104,9 +104,13 @@ class PooledExecutor(base.ExecutorBase):
if not was_submitted:
break
def start(self):
def start(self, override_pool_size=None):
if self._executor is None:
if override_pool_size is not None and int(override_pool_size) < 1:
raise ValueError('The thread pool size should be a positive '
'value.')
self._executor = self._executor_cls(
override_pool_size if override_pool_size else
self.conf.executor_thread_pool_size)
self._tombstone.clear()
if self._poller is None or not self._poller.is_alive():