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");
            }
        }
 public DefaultServerConnectionManager(ConnectionSelectStrategy connectionSelectStrategy) : base(connectionSelectStrategy)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="strategy"> ConnectionSelectStrategy </param>
 public ConnectionPool(ConnectionSelectStrategy strategy)
 {
     this.strategy     = strategy;
     connections       = new List <Connection>();
     asyncCreationDone = true;
 }
Ejemplo n.º 4
0
 public DefaultClientConnectionManager(ConnectionSelectStrategy connectionSelectStrategy, ConnectionFactory connectionFactory, ConnectionEventHandler connectionEventHandler, ConnectionEventListener connectionEventListener, GlobalSwitch globalSwitch) : base(connectionSelectStrategy, connectionFactory, connectionEventHandler, connectionEventListener, globalSwitch)
 {
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Construct with parameters.
 /// </summary>
 /// <param name="connectionSelectStrategy"> connection selection strategy </param>
 /// <param name="connectionFactory"> connection factory </param>
 public DefaultConnectionManager(ConnectionSelectStrategy connectionSelectStrategy, ConnectionFactory connectionFactory) : this(connectionSelectStrategy)
 {
     this.connectionFactory = connectionFactory;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Construct with parameters.
 /// </summary>
 /// <param name="connectionSelectStrategy"> connection selection strategy </param>
 public DefaultConnectionManager(ConnectionSelectStrategy connectionSelectStrategy) : this()
 {
     this.connectionSelectStrategy = connectionSelectStrategy;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public DefaultConnectionManager()
 {
     connTasks = new ConcurrentDictionary <string, RunStateRecordedFutureTask>();
     healTasks = new ConcurrentDictionary <string, FutureTask>();
     connectionSelectStrategy = new RandomSelectStrategy(globalSwitch);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Construct with parameters.
 /// </summary>
 /// <param name="connectionSelectStrategy"> connection selection strategy. </param>
 /// <param name="connectionFactory"> connection factory </param>
 /// <param name="connectionEventHandler"> connection event handler </param>
 /// <param name="connectionEventListener"> connection event listener </param>
 /// <param name="globalSwitch"> global switch </param>
 public DefaultConnectionManager(ConnectionSelectStrategy connectionSelectStrategy, ConnectionFactory connectionFactory, ConnectionEventHandler connectionEventHandler, ConnectionEventListener connectionEventListener, GlobalSwitch globalSwitch) : this(connectionSelectStrategy, connectionFactory, connectionEventHandler, connectionEventListener)
 {
     this.globalSwitch = globalSwitch;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Construct with parameters.
 /// </summary>
 /// <param name="connectionSelectStrategy"> connection selection strategy </param>
 /// <param name="connectionFactory"> connection factory </param>
 /// <param name="connectionEventHandler"> connection event handler </param>
 /// <param name="connectionEventListener"> connection event listener </param>
 public DefaultConnectionManager(ConnectionSelectStrategy connectionSelectStrategy, ConnectionFactory connectionFactory, ConnectionEventHandler connectionEventHandler, ConnectionEventListener connectionEventListener) : this(connectionSelectStrategy, connectionFactory)
 {
     this.connectionEventHandler  = connectionEventHandler;
     this.connectionEventListener = connectionEventListener;
 }