Source:
<code>private boolean query(final Host host) { HostConnectionPool pool = manager.pools.get(host); if (pool == null || pool.isClosed()) return false; if (logger.isTraceEnabled()) logger.trace("[{}] Querying node {}", id, host); if (allowSpeculativeExecutions && nextExecutionScheduled.compareAndSet(false, true)) scheduleExecution(speculativeExecutionPlan.nextExecution(host)); ListenableFuture<Connection> connectionFuture = pool.borrowConnection( manager.configuration().getPoolingOptions().getMaxQueueSize()); Futures.addCallback(connectionFuture, new FutureCallback<Connection>() { @Override public void onSuccess(Connection connection) { if (current != null) { if (triedHosts == null) triedHosts = new CopyOnWriteArrayList<Host>(); triedHosts.add(current); } current = host; try { write(connection, SpeculativeExecution.this); } catch (ConnectionException e) { if (metricsEnabled()) metrics().getErrorMetrics().getConnectionErrors().inc(); if (connection != null) connection.release(); logError(host.getSocketAddress(), e); findNextHostAndQuery(); } catch (BusyConnectionException e) { connection.release(); logError(host.getSocketAddress(), e); findNextHostAndQuery(); } catch (RuntimeException e) { if (connection != null) connection.release(); logger.error("Unexpected error while querying " + host.getAddress(), e); logError(host.getSocketAddress(), e); findNextHostAndQuery(); } } @Override public void onFailure(Throwable t) { if (t instanceof TimeoutException) { <START> logError(host.getSocketAddress(), <END> new DriverException("Timeout while trying to acquire available connection (you may want to increase the driver number of per-host connections)", t)); } else { logger.error("Unexpected error while querying " + host.getAddress(), t); logError(host.getSocketAddress(), t); } findNextHostAndQuery(); } }); return true; }</code><technical_language>Is TimeoutException possible? I noticed Pool is Busy exception is a ConnectionException</technical_language>

Target:
private boolean query(final Host host) { HostConnectionPool pool = manager.pools.get(host); if (pool == null || pool.isClosed()) return false; if (logger.isTraceEnabled()) logger.trace("[{}] Querying node {}", id, host); if (allowSpeculativeExecutions && nextExecutionScheduled.compareAndSet(false, true)) scheduleExecution(speculativeExecutionPlan.nextExecution(host)); ListenableFuture<Connection> connectionFuture = pool.borrowConnection( manager.configuration().getPoolingOptions().getMaxQueueSize()); Futures.addCallback(connectionFuture, new FutureCallback<Connection>() { @Override public void onSuccess(Connection connection) { if (current != null) { if (triedHosts == null) triedHosts = new CopyOnWriteArrayList<Host>(); triedHosts.add(current); } current = host; try { write(connection, SpeculativeExecution.this); } catch (ConnectionException e) { if (metricsEnabled()) metrics().getErrorMetrics().getConnectionErrors().inc(); if (connection != null) connection.release(); logError(host.getSocketAddress(), e); findNextHostAndQuery(); } catch (BusyConnectionException e) { connection.release(); logError(host.getSocketAddress(), e); findNextHostAndQuery(); } catch (RuntimeException e) { if (connection != null) connection.release(); logger.error("Unexpected error while querying " + host.getAddress(), e); logError(host.getSocketAddress(), e); findNextHostAndQuery(); } } @Override public void onFailure(Throwable t) { if (t instanceof BusyPoolException) { logError(host.getSocketAddress(), t); } else { logger.error("Unexpected error while querying " + host.getAddress(), t); logError(host.getSocketAddress(), t); } findNextHostAndQuery(); } }); return true; }