When a background reconnection attempt succeeds, we immediately trash the connection that was just established, and then proceed to mark the node UP, which will recreate a pool to the node.
As noted in code comments, this is inefficient because that first connection could be kept open and used by the pool. This is important for clusters with a huge number of clients, where even short-lived connections can have an impact on the server (see the comments in ).
A bit of refactoring is necessary, because the first connection is a Connection, but the pool uses the subclass PooledConnection, and we can't magically turn an object into an instance of its subclass. Using composition over inheritance might help.
The fix can be re-applied by cherry-picking commits 36a330f, 6eada94 and cf3ba3e. I'll wait for to be merged on 2.0, to handle all the merges in one pass.
To do on top of that patch: also reuse the connection to prepare queries, see JAVA-658.