Source:
<code>public ListenableFuture<Void> initAsync(Connection reusedConnection) { String keyspace = manager.poolsState.keyspace; final int coreSize = options().getCoreConnectionsPerHost(hostDistance); final List<Connection> connections = Lists.newArrayListWithCapacity(coreSize); final List<ListenableFuture<Void>> connectionFutures = Lists.newArrayListWithCapacity(coreSize); for (int i = 0; i < coreSize; i++) { Connection connection; ListenableFuture<Void> connectionFuture; if (reusedConnection != null && reusedConnection.setOwner(this)) { connection = reusedConnection; connectionFuture = MoreFutures.VOID_SUCCESS; } else { connection = manager.connectionFactory().newConnection(this); connectionFuture = connection.initAsync(); } reusedConnection = null; connections.add(connection); connectionFutures.add(setKeyspaceAsync(connectionFuture, connection, keyspace)); } Executor initExecutor = manager.cluster.manager.configuration.getPoolingOptions().getInitializationExecutor(); ListenableFuture<List<Void>> allConnectionsFuture = Futures.allAsList(connectionFutures); final SettableFuture<Void> initFuture = SettableFuture.create(); Futures.addCallback(allConnectionsFuture, new FutureCallback<List<Void>>() { @Override public void onSuccess(List<Void> l) { ListIterator<Connection> it = connections.listIterator(); while (it.hasNext()) { if (it.next().isClosed()) it.remove(); } HostConnectionPool.this.connections.addAll(connections); open.set(connections.size()); if (isClosed()) { initFuture.setException(new ConnectionException(host.getSocketAddress(), "Pool was closed during initialization")); forceClose(connections); } else { logger.debug("Created connection pool to host ({} connections needed, successfully opened)", host, coreSize, connections.size()); phase.compareAndSet(Phase.INITIALIZING, Phase.READY); initFuture.set(null); } } @Override <START> public void onFailure(Throwable t) { <END> phase.compareAndSet(Phase.INITIALIZING, Phase.INIT_FAILED); forceClose(connections); initFuture.setException(t); } }, initExecutor); return initFuture; }</code><technical_language>this odds JAVA-544 (#420) if connections fail onFailure invoked close connections succeeded, mark this future failed pool set in SessionManager.pools in SessionManager.forceRenewPool</technical_language>

Target:
public ListenableFuture<Void> initAsync(Connection reusedConnection) { String keyspace = manager.poolsState.keyspace; Executor initExecutor = manager.cluster.manager.configuration.getPoolingOptions().getInitializationExecutor(); final int coreSize = options().getCoreConnectionsPerHost(hostDistance); final List<Connection> connections = Lists.newArrayListWithCapacity(coreSize); final List<ListenableFuture<Void>> connectionFutures = Lists.newArrayListWithCapacity(coreSize); for (int i = 0; i < coreSize; i++) { Connection connection; ListenableFuture<Void> connectionFuture; if (reusedConnection != null && reusedConnection.setOwner(this)) { connection = reusedConnection; connectionFuture = MoreFutures.VOID_SUCCESS; } else { connection = manager.connectionFactory().newConnection(this); connectionFuture = connection.initAsync(); } reusedConnection = null; connections.add(connection); connectionFutures.add(handleErrors(setKeyspaceAsync(connectionFuture, connection, keyspace), initExecutor)); } ListenableFuture<List<Void>> allConnectionsFuture = Futures.allAsList(connectionFutures); final SettableFuture<Void> initFuture = SettableFuture.create(); Futures.addCallback(allConnectionsFuture, new FutureCallback<List<Void>>() { @Override public void onSuccess(List<Void> l) { ListIterator<Connection> it = connections.listIterator(); while (it.hasNext()) { if (it.next().isClosed()) it.remove(); } HostConnectionPool.this.connections.addAll(connections); open.set(connections.size()); if (isClosed()) { initFuture.setException(new ConnectionException(host.getSocketAddress(), "Pool was closed during initialization")); forceClose(connections); } else { logger.debug("Created connection pool to host ({} connections needed, successfully opened)", host, coreSize, connections.size()); phase.compareAndSet(Phase.INITIALIZING, Phase.READY); initFuture.set(null); } } @Override public void onFailure(Throwable t) { phase.compareAndSet(Phase.INITIALIZING, Phase.INIT_FAILED); forceClose(connections); initFuture.setException(t); } }, initExecutor); return initFuture; }