Beispiel #1
0
        public ThriftClientPool(string sectionName, string serviceName, string spaceName, string className)
        {
            _config = new ThriftClientConfig(sectionName, serviceName, UpdatePool, spaceName, className);

            if (_config.ServiceConfig.IncrementalConnections < 0)
            {
                throw new Exception("每次增长连接数不能小于0");
            }
            if (_config.ServiceConfig.MinConnectionsNum < 0)
            {
                throw new Exception("最小连接池不能小于0");
            }
            if (_config.ServiceConfig.MinConnectionsNum > _config.ServiceConfig.MaxConnectionsNum)
            {
                throw new Exception("最大连接池不能小于最小连接池");
            }

            CreateConnections(_config.ServiceConfig.MinConnectionsNum);
        }
Beispiel #2
0
        public ThriftClientNoPool(string sectionName, string serviceName, string spaceName, string className)
        {
            _config = new ThriftClientConfig(sectionName, serviceName, UpdatePool, spaceName, className);

            _host      = _config.ServiceConfig.Host.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            _hostCount = _host.Length;
            _hostIndex = 0;

            if (_config.ServiceConfig.IncrementalConnections < 0)
            {
                throw new Exception("每次增长连接数不能小于0");
            }
            if (_config.ServiceConfig.MinConnectionsNum < 0)
            {
                throw new Exception("最小连接池不能小于0");
            }
            if (_config.ServiceConfig.MinConnectionsNum > _config.ServiceConfig.MaxConnectionsNum)
            {
                throw new Exception("最大连接池不能小于最小连接池");
            }
        }