kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 14b391abab4f6009b782b0dda3689df2473c94f29ebab73c395a622a711fa841 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-12-18 13:46 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-12-19 00:22 +01:00 |
| Parents | 0f17d5b313f1 |
1 file changed
modified driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java +13 −3
| @@ -235,7 +235,8 @@ | ||
| 235 | 235 | return errors; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - private Connection tryConnect(Host host, boolean isInitialConnection) throws ConnectionException, ExecutionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException { | |
| 238 | + private Connection tryConnect(Host host, boolean isInitialConnection) throws ConnectionException, ExecutionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException | |
| 239 | + { | |
| 239 | 240 | Connection connection = cluster.connectionFactory.open(host); |
| 240 | 241 | |
| 241 | 242 | try { |
| @@ -258,10 +259,19 @@ | ||
| 258 | 259 | refreshSchema(connection, null, null, cluster, isInitialConnection); |
| 259 | 260 | return connection; |
| 260 | 261 | } catch (BusyConnectionException e) { |
| 261 | - connection.closeAsync().get(); | |
| 262 | + connection.closeAsync().force(); | |
| 262 | 263 | throw new DriverInternalError("Newly created connection should not be busy"); |
| 264 | + } catch (InterruptedException e) { | |
| 265 | + connection.closeAsync().force(); | |
| 266 | + throw e; | |
| 267 | + } catch (ConnectionException e) { | |
| 268 | + connection.closeAsync().force(); | |
| 269 | + throw e; | |
| 270 | + } catch (ExecutionException e) { | |
| 271 | + connection.closeAsync().force(); | |
| 272 | + throw e; | |
| 263 | 273 | } catch (RuntimeException e) { |
| 264 | - connection.closeAsync().get(); | |
| 274 | + connection.closeAsync().force(); | |
| 265 | 275 | throw e; |
| 266 | 276 | } |
| 267 | 277 | } |