kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | c650795a337f621cf0a5e2ca620ccc5192ed01dfe4678c7e24462bb67dc651ec |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-08-08 10:29 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-08-08 15:01 +02:00 |
| Parents | 850ce3bd6c2b |
4 files changed
modified driver-core/CHANGELOG.rst +1 −0
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | - [bug] Release connections on ResultSetFuture#cancel (JAVA-407) |
| 8 | 8 | - [bug] Fix handling of SimpleStatement with values in query builder |
| 9 | 9 | batches (JAVA-393) |
| 10 | +- [bug] Ensure pool is properly closed in onDown (JAVA-417) | |
| 10 | 11 | |
| 11 | 12 | |
| 12 | 13 | 2.0.4: |
modified driver-core/src/main/java/com/datastax/driver/core/Connection.java +4 −2
| @@ -628,9 +628,11 @@ | ||
| 628 | 628 | public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) { |
| 629 | 629 | // If we've closed the channel client side then we don't really want to defunct the connection, but |
| 630 | 630 | // if there is remaining thread waiting on us, we still want to wake them up |
| 631 | - if (!isInitialized || isClosed()) | |
| 631 | + if (!isInitialized || isClosed()) { | |
| 632 | 632 | errorOutAllHandler(new TransportException(address, "Channel has been closed")); |
| 633 | - else | |
| 633 | + // we still want to force so that the future completes | |
| 634 | + Connection.this.closeAsync().force(); | |
| 635 | + } else | |
| 634 | 636 | defunct(new TransportException(address, "Channel has been closed")); |
| 635 | 637 | } |
| 636 | 638 | } |
modified driver-core/src/main/java/com/datastax/driver/core/PooledConnection.java +1 −1
| @@ -45,7 +45,7 @@ | ||
| 45 | 45 | return; |
| 46 | 46 | |
| 47 | 47 | if (hostIsDown) { |
| 48 | - pool.closeAsync(); | |
| 48 | + pool.closeAsync().force(); | |
| 49 | 49 | } else { |
| 50 | 50 | pool.replace(this); |
| 51 | 51 | } |
modified driver-core/src/main/java/com/datastax/driver/core/SessionManager.java +3 −3
| @@ -283,10 +283,10 @@ | ||
| 283 | 283 | }); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - ListenableFuture<?> removePool(Host host) { | |
| 286 | + CloseFuture removePool(Host host) { | |
| 287 | 287 | final HostConnectionPool pool = pools.remove(host); |
| 288 | 288 | return pool == null |
| 289 | - ? Futures.immediateFuture(null) | |
| 289 | + ? CloseFuture.immediateFuture() | |
| 290 | 290 | : pool.closeAsync(); |
| 291 | 291 | } |
| 292 | 292 | |
| @@ -341,7 +341,7 @@ | ||
| 341 | 341 | void onDown(Host host) throws InterruptedException, ExecutionException { |
| 342 | 342 | // Note that with well behaved balancing policy (that ignore dead nodes), the removePool call is not necessary |
| 343 | 343 | // since updateCreatedPools should take care of it. But better protect against non well behaving policies. |
| 344 | - removePool(host).get(); | |
| 344 | + removePool(host).force().get(); | |
| 345 | 345 | updateCreatedPools(MoreExecutors.sameThreadExecutor()); |
| 346 | 346 | } |
| 347 | 347 |