private void init() { cm = new DefaultClientConnectionManager(connectionSelectStrategy, connectionFactory, connectionEventHandler, connectionEventListener); cm.AddressParser = addressParser; cm.startup(); server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); }
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"); } }