public async Task Release(RiakPbcSocket socket) { _resources.Dequeue(socket); if (_disposing) return; if (socket != null) { socket.Dispose(); } }
public async Task<RiakPbcSocket> CreateSocket() { var socket = new RiakPbcSocket( _nodeConfig.HostAddress, _nodeConfig.PbcPort, _nodeConfig.NetworkReadTimeout, _nodeConfig.NetworkWriteTimeout, _nodeConfig.IdleTimeout, _pool, _bufferManager); _resources.Enqueue(socket); return socket; }
private void Init() { _allResources = new List<RiakPbcSocket>(); for (var i = 0; i < _poolSize; ++i) { var socket = new RiakPbcSocket( _hostAddress, _pbcPort, _networkReadTimeout, _networkWriteTimeout, _idleTimeout, _pool, _blockingBufferManager); _allResources.Add(socket); } _resources = new BlockingCollection<RiakPbcSocket>(new ConcurrentQueue<RiakPbcSocket>(_allResources)); }
public async Task Release(RiakPbcSocket socket) { if (_disposing) return; _resources.Add(socket); }