@Override
public Connection<CL> borrowConnection(Operation<CL, R> operation) throws ConnectionException {
// find the pool with the least outstanding (i.e most idle) active connections
Iterator<HostConnectionPool<CL>> iterator = this.pools.iterator();
HostConnectionPool eligible = iterator.next();
while (iterator.hasNext()) {
HostConnectionPool<CL> candidate = iterator.next();
if (candidate.getIdleConnectionCount() > eligible.getIdleConnectionCount()) {
eligible = candidate;
}
}
return eligible.borrowConnection(waitDelta * waitMultiplier);
}