def __init__(self): self._workers_waiting = 0 self._heartbeat_waiting = False self._lock_acquired = None self._monitor = threading.Lock() self._workers_locks = threading.Condition(self._monitor) self._heartbeat_lock = threading.Condition(self._monitor) self._get_thread_id = _utils.fetch_current_thread_functor()
def __init__(self, transport, dispatcher, executor='blocking'): """Construct a message handling server. The dispatcher parameter is a callable which is invoked with context and message dictionaries each time a message is received. The executor parameter controls how incoming messages will be received and dispatched. By default, the most simple executor is used - the blocking executor. :param transport: the messaging transport :type transport: Transport :param dispatcher: a callable which is invoked for each method :type dispatcher: callable :param executor: name of message executor - for example 'eventlet', 'blocking' :type executor: str """ self.conf = transport.conf self.transport = transport self.dispatcher = dispatcher self.executor = executor self._get_thread_id = _utils.fetch_current_thread_functor() try: mgr = driver.DriverManager('oslo.messaging.executors', self.executor) except RuntimeError as ex: raise ExecutorLoadFailure(self.executor, ex) else: self._executor_cls = mgr.driver self._executor = None self._running = False self._thread_id = None super(MessageHandlingServer, self).__init__()