- public void operationComplete(final Future<S> future) {
- synchronized (lock) {
- if (!future.isSuccess()) {
- final Future<Void> rf = ReconnectPromise.this.strategy.scheduleReconnect(cf.cause());
-
- if(rf == null) {
- // This should reflect: no more reconnecting strategies, enough
- // Currently all reconnect strategies fail with exception, should return null
- return;
- }
-
- ReconnectPromise.this.pending = rf;
-
- rf.addListener(new FutureListener<Void>() {
- @Override
- public void operationComplete(final Future<Void> sf) {
- synchronized (lock) {
- /*
- * The promise we gave out could have been cancelled,
- * which cascades to the reconnect attempt getting
- * cancelled, but there is a slight race window, where
- * the reconnect attempt is already enqueued, but the
- * listener has not yet been notified -- if cancellation
- * happens at that point, we need to catch it here.
- */
- if (!isCancelled()) {
- if (sf.isSuccess()) {
- connect();
- } else {
- setFailure(sf.cause());
- }
- }
- }
- }
- });
- } else {
- /*
- * FIXME: BUG-190: we have a slight race window with cancellation
- * here. Analyze and define its semantics.
- */
- ReconnectPromise.this.strategy.reconnectSuccessful();
- negotiationFinished.set(true);
- }
+ public void operationComplete(Future<Object> future) throws Exception {
+ if (!future.isSuccess()) {
+ ReconnectPromise.this.setFailure(future.cause());