Skip to content

Commit

Permalink
shutdown whenComplete instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturobernalg committed Apr 13, 2023
1 parent 833fc54 commit fe6b360
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ public Future<ManagedAsyncClientConnection> connect(
// If there is an exception, complete the connectionFuture exceptionally with the exception
connectionFuture.completeExceptionally(new ConnectException("Failed to connect to any address for " + host));
}
shutdownSchedulerIfTasksCompleted();
// Invoke the callback if provided
if (callback != null) {
connectionFuture.whenComplete((conn, ex) -> {
Expand All @@ -439,7 +438,9 @@ public Future<ManagedAsyncClientConnection> connect(
callback.failed(new Exception(e));
}
return null;
});

}).whenComplete((result, ex) -> shutdownSchedulerIfTasksCompleted());

return connectionFuture;
}

Expand Down

0 comments on commit fe6b360

Please sign in to comment.