/// <summary> /// Implementation of the IDisposable interface. /// Recycle the client instance. /// </summary> public void Dispose() { if (_client.IsNotNull()) { PushClient(_client); } _client = null; }
/// <summary> /// Add an Elasticsearch low level client instance to the client pool. /// <param name="client">An Elasticsearch low level client.</param> /// </summary> private static void PushClient(ElasticLowLevelClient client) { lock (_clients) { if (client.IsNotNull() && (_clients.Count < MaxClientCount)) { _clients.Add(client); } } }