public DecorateTransport(TTransport transport, ThriftConnectionStore store, ThriftService service, TransportPoolItem item)
 {
     Contract.Assert(transport != null && item != null && service != null && store != null);
     _transport       = transport;
     _item            = item;
     _service         = service;
     _connectionStore = store;
 }
Esempio n. 2
0
        public ThriftConnectionPool(int connectionLimit, int waitFreeMillisecond, int waitFreeTimes, TimeSpan transportOverdueInterval)
        {
            if (connectionLimit <= 0)
            {
                throw new ArgumentException("连接池的最大连接数小于等于0");
            }
            if (waitFreeMillisecond < 0)
            {
                throw new ArgumentException("等待其它线程释放连接的超时时间(毫秒)不能小于0毫秒");
            }
            if (waitFreeTimes <= 0)
            {
                throw new ArgumentException("尝试等待其它线程释放连接的次数不能小于等于0次");
            }
            if (transportOverdueInterval == TimeSpan.Zero)
            {
                throw new ArgumentNullException("thrift连接过期时间不能为0");
            }

            _connectionStore = new ThriftConnectionStore(connectionLimit, waitFreeMillisecond, transportOverdueInterval);
        }