https://issues.apache.org/jira/browse/TINKERPOP-2135
Closed connections are now removed from the pool. This also required a slight change to the population of the pool as it needs to be able to only populate the pool partially when some connections were removed. The previous assumption was that the pool is either completely populated or completely empty which doesn't hold true any more. I changed the underlying data structure that holds the connections from `ConcurrentBag` to `ConcurrectDictionary` because `ConcurrentBag` provides no way to efficiently remove a single element. We would have to take all connections out of the bag and then add all but the closed one back into the bag afterwards. `ConcurrentDictionary` makes this more efficient although it looks a bit strange to use a dictionary if we don't really need any key-value-assignment, but unfortunately there is nothing like a `ConcurrentList` right now. The second commit here is basically optional. It simply wraps the `ConcurrentBag` in a custom collection that offers the API the `ConnectionPool` needs. Accessing a dictionary while only using the keys resulted in strange looking API calls that could be distracting. Also, the data structure used should not leak into nearly every method in `ConnectionPool`. If others disagree here, then I can also revert the second commit as it is really only a refactoring. VOTE +1 [ Full content available at: https://github.com/apache/tinkerpop/pull/1077 ] This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org