Skip to content

Commit

Permalink
Leak on server shutdown while still awaiting other nodes to join
Browse files Browse the repository at this point in the history
  • Loading branch information
franz1981 committed Apr 14, 2021
1 parent 6115209 commit b5bb36b
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -157,10 +157,14 @@ public boolean isRunning() {
* @return A completable future to be completed once the server has been shutdown.
*/
public CompletableFuture<Void> shutdown() {
if (!started) {
return Futures.exceptionalFuture(new IllegalStateException("Server not running"));
if (!started && openFuture == null) {
synchronized (this) {
if (openFuture == null) {
return Futures.exceptionalFuture(new IllegalStateException("Server not running"));
}
}
}

assert openFuture != null;
CompletableFuture<Void> future = new AtomixFuture<>();
context.getThreadContext().execute(() -> {
started = false;
Expand Down

0 comments on commit b5bb36b

Please sign in to comment.