kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 85b9ff98a74326bd739972db680125e4251020f9d6eaa89e221d675fdc610509 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-10-15 15:58 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-10-15 17:40 +02:00 |
| Parents | 8c0b4c94af46 |
1 file changed
modified driver-core/src/main/java/com/datastax/driver/core/Connection.java +9 −2
| @@ -261,8 +261,15 @@ | ||
| 261 | 261 | // sure the "suspected" mechanism work as expected |
| 262 | 262 | Host host = factory.manager.metadata.getHost(address); |
| 263 | 263 | if (host != null) { |
| 264 | - boolean isDown = factory.manager.signalConnectionFailure(host, ce, host.wasJustAdded(), isInitialized); | |
| 265 | - notifyOwnerWhenDefunct(isDown); | |
| 264 | + // If we get an error on a host that was already DOWN or SUSPECTED, this is a reconnection attempt. | |
| 265 | + // We don't want to signal, because that would invoke triggerOnDown unnecessarily (the host's bad | |
| 266 | + // condition is already taken care of by the reattempt in progress) | |
| 267 | + boolean isReconnectionAttempt = (host.state == Host.State.DOWN || host.state == Host.State.SUSPECT) | |
| 268 | + && !(this instanceof PooledConnection); | |
| 269 | + if (!isReconnectionAttempt) { | |
| 270 | + boolean isDown = factory.manager.signalConnectionFailure(host, ce, host.wasJustAdded(), isInitialized); | |
| 271 | + notifyOwnerWhenDefunct(isDown); | |
| 272 | + } | |
| 266 | 273 | } |
| 267 | 274 | |
| 268 | 275 | // Force the connection to close to make sure the future completes. Otherwise force() might never get called and |