示例#1
0
        public HttpConnection(IConnectionSettings2 settings)
        {
            if (settings == null)
                throw new ArgumentNullException("settings");

            this._ConnectionSettings = settings;
            if (settings.MaximumAsyncConnections > 0)
            {
                var semaphore = Math.Max(1, settings.MaximumAsyncConnections);
                this._ResourceLock = new Semaphore(semaphore, semaphore);
            }
            this._enableTrace = settings.TraceEnabled;
        }
示例#2
0
        public ThriftConnection(IConnectionSettings2 connectionSettings)
        {
            this._connectionSettings = connectionSettings;
            this._timeout = connectionSettings.Timeout;
            this._poolSize = Math.Max(1, connectionSettings.MaximumAsyncConnections);

            this._resourceLock = new Semaphore(_poolSize, _poolSize);

            for (var i = 0; i <= connectionSettings.MaximumAsyncConnections; i++)
            {
                var tsocket = new TSocket(connectionSettings.Host, connectionSettings.Port);
                var transport = new TBufferedTransport(tsocket, 1024);
                var protocol = new TBinaryProtocol(transport);
                var client = new Rest.Client(protocol);
                _clients.Enqueue(client);
            }
        }
 public InMemoryConnection(IConnectionSettings2 settings, ElasticsearchResponse fixedResult)
     : base(settings)
 {
     this._fixedResult = fixedResult;
 }
 public ElasticsearchHttpClient(IConnectionSettings2 settings)
 {
     _settings = settings;
 }
 public InMemoryConnection(IConnectionSettings2 settings)
     : base(settings)
 {
 }