def __init__(self, service, context_manager, settings_view_factory): """ Args: service (Interconnect): The zmq internal interface context_manager (ContextManager): Cache of state for tps settings_view_factory (SettingsViewFactory): Read-only view of setting state. Attributes: processors (ProcessorIteratorCollection): All of the registered transaction processors and a way to find the next one to send to. _waiting_threadpool (ThreadPoolExecutor): A threadpool to run waiting to process transactions functions in. _waiters_by_type (_WaitersByType): Threadsafe map of ProcessorType to _Waiter that is waiting on a processor of that type. """ self._service = service self._context_manager = context_manager self.processors = processor_iterator.ProcessorIteratorCollection( processor_iterator.RoundRobinProcessorIterator) self._settings_view_factory = settings_view_factory self._waiting_threadpool = ThreadPoolExecutor(max_workers=3) self._executing_threadpool = ThreadPoolExecutor(max_workers=5) self._alive_threads = [] self._lock = threading.Lock() self._open_futures = ThreadsafeDict()
def __init__(self, url): self._handlers = {} self._processors = processor_iterator.ProcessorIteratorCollection( processor_iterator.RoundRobinProcessorIterator) self._futures = future.FutureCollection() self._send_receive_thread = _SendReceiveThread(url, self._handlers, self._futures)
def __init__(self, service, context_manager, settings_view_factory, scheduler_type, invalid_observers=None, metrics_registry=None): """ Args: service (Interconnect): The zmq internal interface context_manager (ContextManager): Cache of state for tps settings_view_factory (SettingsViewFactory): Read-only view of setting state. Attributes: processors (ProcessorIteratorCollection): All of the registered transaction processors and a way to find the next one to send to. _waiting_threadpool (ThreadPoolExecutor): A threadpool to run waiting to process transactions functions in. _waiters_by_type (_WaitersByType): Threadsafe map of ProcessorType to _Waiter that is waiting on a processor of that type. """ self._service = service self._context_manager = context_manager self.processors = processor_iterator.ProcessorIteratorCollection( processor_iterator.RoundRobinProcessorIterator) self._settings_view_factory = settings_view_factory self._waiting_threadpool = InstrumentedThreadPoolExecutor( max_workers=MAX_WORKERS_WAIT, name='Waiting', metrics_registry=metrics_registry) self._executing_threadpool = InstrumentedThreadPoolExecutor( max_workers=MAX_WORKERS_EXEC, name='Executing', metrics_registry=metrics_registry) self._alive_threads = [] self._lock = threading.Lock() self._invalid_observers = ([] if invalid_observers is None else invalid_observers) self._scheduler_type = scheduler_type self._metrics_registry = metrics_registry self._malicious = 0
def __init__(self, service, context_manager): self._service = service self._context_manager = context_manager self.processors = processor_iterator.ProcessorIteratorCollection( processor_iterator.RoundRobinProcessorIterator)