kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 46e39b8b4a39485e094c7ab97bb07bbe6b9716da7d4a49285f0c458d5104f420 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-09-17 17:07 -07:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-09-23 11:34 +02:00 |
| Parents | 8b1fec78dfd4 |
3 files changed
modified driver-core/CHANGELOG.rst +1 −0
| @@ -6,6 +6,7 @@ | ||
| 6 | 6 | |
| 7 | 7 | - [bug] Handle null pool in PooledConnection.release (JAVA-449) |
| 8 | 8 | - [bug] Prevent concurrent retries of the same query (JAVA-449) |
| 9 | +- [improvement] Defunct connection on request timeout (JAVA-425) | |
| 9 | 10 | |
| 10 | 11 | |
| 11 | 12 | 2.0.6: |
modified driver-core/src/main/java/com/datastax/driver/core/Connection.java +0 −1
| @@ -827,7 +827,6 @@ | ||
| 827 | 827 | @Override |
| 828 | 828 | public void run(Timeout timeout) { |
| 829 | 829 | callback.onTimeout(connection, System.nanoTime() - startTime); |
| 830 | - cancelHandler(); | |
| 831 | 830 | } |
| 832 | 831 | }; |
| 833 | 832 | } |
modified driver-core/src/main/java/com/datastax/driver/core/RequestHandler.java +5 −3
| @@ -513,10 +513,12 @@ | ||
| 513 | 513 | public void onTimeout(Connection connection, long latency) { |
| 514 | 514 | Host queriedHost = current; |
| 515 | 515 | try { |
| 516 | - if (connection instanceof PooledConnection) | |
| 517 | - ((PooledConnection)connection).release(); | |
| 516 | + // If a query times out, we consider that the host is unstable, so we defunct | |
| 517 | + // the connection to mark it down. | |
| 518 | + DriverException timeoutException = new DriverException("Timed out waiting for server response"); | |
| 519 | + connection.defunct(timeoutException); | |
| 518 | 520 | |
| 519 | - logError(connection.address, new DriverException("Timeout during read")); | |
| 521 | + logError(connection.address, timeoutException); | |
| 520 | 522 | retry(false, null); |
| 521 | 523 | } catch (Exception e) { |
| 522 | 524 | // This shouldn't happen, but if it does, we want to signal the callback, not let him hang indefinitively |