Example #1
0
 def __init__(self,
              stackParams: dict,
              msgHandler: Callable,
              registry: Dict[str, HA],
              seed=None,
              sighex: str = None):
     Batched.__init__(self)
     KITZStack.__init__(self,
                        stackParams,
                        msgHandler,
                        registry=registry,
                        seed=seed,
                        sighex=sighex,
                        listenerQuota=config.LISTENER_MESSAGE_QUOTA,
                        remoteQuota=config.REMOTES_MESSAGE_QUOTA)
     MessageProcessor.__init__(self, allowDictOnly=False)
Example #2
0
    def __init__(self,
                 stackParams: dict,
                 msgHandler: Callable,
                 seed=None,
                 config=None,
                 msgRejectHandler=None,
                 metrics=NullMetricsCollector(),
                 timer=None):
        config = config or getConfig()

        simple_zstack_class.__init__(
            self,
            stackParams,
            msgHandler,
            seed=seed,
            onlyListener=True,
            config=config,
            msgRejectHandler=msgRejectHandler,
            create_listener_monitor=config.TRACK_CONNECTED_CLIENTS_NUM_ENABLED,
            metrics=metrics,
            mt_incoming_size=MetricsName.INCOMING_CLIENT_MESSAGE_SIZE,
            mt_outgoing_size=MetricsName.OUTGOING_CLIENT_MESSAGE_SIZE,
            timer=timer)
        MessageProcessor.__init__(self, allowDictOnly=False)

        if config.CLIENT_STACK_RESTART_ENABLED and not config.TRACK_CONNECTED_CLIENTS_NUM_ENABLED:
            error_str = '{}: client stack restart is enabled (CLIENT_STACK_RESTART_ENABLED) ' \
                        'but connections tracking is disabled (TRACK_CONNECTED_CLIENTS_NUM_ENABLED), ' \
                        'please check your configuration'.format(self)
            raise RuntimeError(error_str)

        self.track_connected_clients_num_enabled = config.TRACK_CONNECTED_CLIENTS_NUM_ENABLED
        self.client_stack_restart_enabled = config.CLIENT_STACK_RESTART_ENABLED
        self.max_connected_clients_num = config.MAX_CONNECTED_CLIENTS_NUM
        self.postrestart_wait_time = config.STACK_POSTRESTART_WAIT_TIME
        self.min_stack_restart_timeout = config.MIN_STACK_RESTART_TIMEOUT
        self.max_stack_restart_time_deviation = config.MAX_STACK_RESTART_TIME_DEVIATION
        self.listenerQuota = config.CLIENT_TO_NODE_STACK_QUOTA
        self.listenerSize = config.CLIENT_TO_NODE_STACK_SIZE

        if self.track_connected_clients_num_enabled:
            logger.info(
                '{}: clients connections tracking is enabled.'.format(self))
            self.init_connections_tracking_params()
        if self.client_stack_restart_enabled:
            logger.info('{}: client stack restart is enabled.'.format(self))
            self.init_stack_restart_params()
Example #3
0
 def __init__(self,
              stackParams: dict,
              msgHandler: Callable,
              registry: Dict[str, HA],
              seed=None,
              sighex: str = None,
              config=None):
     config = config or getConfig()
     Batched.__init__(self, config=config)
     KITZStack.__init__(self,
                        stackParams,
                        msgHandler,
                        registry=registry,
                        seed=seed,
                        sighex=sighex,
                        config=config)
     MessageProcessor.__init__(self, allowDictOnly=False)
Example #4
0
 def __init__(self,
              stackParams: dict,
              msgHandler: Callable,
              registry: Dict[str, HA],
              seed=None,
              sighex: str = None,
              config=None,
              metrics=NullMetricsCollector()):
     config = config or getConfig()
     Batched.__init__(self, config=config, metrics=metrics)
     KITZStack.__init__(
         self,
         stackParams,
         msgHandler,
         registry=registry,
         seed=seed,
         sighex=sighex,
         config=config,
         metrics=metrics,
         mt_incoming_size=MetricsName.INCOMING_NODE_MESSAGE_SIZE,
         mt_outgoing_size=MetricsName.OUTGOING_NODE_MESSAGE_SIZE)
     MessageProcessor.__init__(self, allowDictOnly=False)