kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | e4567c749def7472df28cf5ad7d09c3e4ca2bdbe8d6348e3c709c3c01b365ab7 |
|---|---|
| Author | Flavio <f.baro@libero.it> · 2015-06-11 12:11 +02:00 |
| Committer | Alexandre Dutra <alexandre.dutra@datastax.com> · 2015-06-11 16:17 +02:00 |
| Parents | e101ab366c7b |
1 file changed
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +10 −8
| @@ -280,14 +280,16 @@ | ||
| 280 | 280 | long timeout = getConfiguration().getSocketOptions().getConnectTimeoutMillis(); |
| 281 | 281 | Session session = connect(); |
| 282 | 282 | try { |
| 283 | - ResultSetFuture future = session.executeAsync("USE " + keyspace); | |
| 284 | - // Note: using the connection timeout isn't perfectly correct, we should probably change that someday | |
| 285 | - Uninterruptibles.getUninterruptibly(future, timeout, TimeUnit.MILLISECONDS); | |
| 286 | - return session; | |
| 287 | - } catch (TimeoutException e) { | |
| 288 | - throw new DriverInternalError(String.format("No responses after %d milliseconds while setting current keyspace. This should not happen, unless you have setup a very low connection timeout.", timeout)); | |
| 289 | - } catch (ExecutionException e) { | |
| 290 | - throw DefaultResultSetFuture.extractCauseFromExecutionException(e); | |
| 283 | + try { | |
| 284 | + ResultSetFuture future = session.executeAsync("USE " + keyspace); | |
| 285 | + // Note: using the connection timeout isn't perfectly correct, we should probably change that someday | |
| 286 | + Uninterruptibles.getUninterruptibly(future, timeout, TimeUnit.MILLISECONDS); | |
| 287 | + return session; | |
| 288 | + } catch (TimeoutException e) { | |
| 289 | + throw new DriverInternalError(String.format("No responses after %d milliseconds while setting current keyspace. This should not happen, unless you have setup a very low connection timeout.", timeout)); | |
| 290 | + } catch (ExecutionException e) { | |
| 291 | + throw DefaultResultSetFuture.extractCauseFromExecutionException(e); | |
| 292 | + } | |
| 291 | 293 | } catch (RuntimeException e) { |
| 292 | 294 | session.close(); |
| 293 | 295 | throw e; |