Ejemplo n.º 1
0
        public override void startup()
        {
            base.startup();

            if (addressParser == null)
            {
                addressParser = new RpcAddressParser();
            }

            ConnectionSelectStrategy connectionSelectStrategy = (ConnectionSelectStrategy)option(BoltGenericOption.CONNECTION_SELECT_STRATEGY);

            if (connectionSelectStrategy == null)
            {
                connectionSelectStrategy = new RandomSelectStrategy(switches());
            }
            connectionManager = new DefaultClientConnectionManager(connectionSelectStrategy, new RpcConnectionFactory(userProcessors, this), connectionEventHandler, connectionEventListener, switches());
            connectionManager.AddressParser = addressParser;
            connectionManager.startup();
            rpcRemoting = new RpcClientRemoting(new RpcCommandFactory(), addressParser, connectionManager);
            taskScanner.add(connectionManager);
            taskScanner.startup();

            if (switches().isOn(GlobalSwitch.CONN_MONITOR_SWITCH))
            {
                if (monitorStrategy == null)
                {
                    connectionMonitor = new DefaultConnectionMonitor(new ScheduledDisconnectStrategy(), connectionManager);
                }
                else
                {
                    connectionMonitor = new DefaultConnectionMonitor(monitorStrategy, connectionManager);
                }
                connectionMonitor.startup();
                logger.LogWarning("Switch on connection monitor");
            }
            if (switches().isOn(GlobalSwitch.CONN_RECONNECT_SWITCH))
            {
                reconnectManager = new ReconnectManager(connectionManager);
                reconnectManager.startup();

                connectionEventHandler.Reconnector = reconnectManager;
                logger.LogWarning("Switch on reconnect manager");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// init rpc remoting
 /// </summary>
 protected internal virtual void initRpcRemoting()
 {
     rpcRemoting = new RpcServerRemoting(new RpcCommandFactory(), addressParser, connectionManager);
 }