NettyAsyncHttpProvider.doConnect() always calls activeConnectionsCount.getAndIncrement() (see if-statement around line 465 ). Later on, it calls lookupInCache() to see if an existing connection exists. When this succeeds, however, activeConnectionsCount is not decremented.
In general, keeping these two pieces of state in sync seems tricky and error prone. Maybe it's worth introducing a generic object pooling component?
NettyAsyncHttpProvider.doConnect() always calls activeConnectionsCount.getAndIncrement() (see if-statement around line 465 ). Later on, it calls lookupInCache() to see if an existing connection exists. When this succeeds, however, activeConnectionsCount is not decremented.
In general, keeping these two pieces of state in sync seems tricky and error prone. Maybe it's worth introducing a generic object pooling component?