Skip to content

Commit

Permalink
Avoid the NPE in Heart.beat when shutting down
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsembwever committed May 31, 2018
1 parent 5360688 commit c5d3b1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class RepairManager {
public final class RepairManager implements AutoCloseable {

private static final Logger LOG = LoggerFactory.getLogger(RepairManager.class);

Expand Down Expand Up @@ -372,4 +372,10 @@ private static void releaseLead(AppContext context, UUID leaderElectionId) {
}
}
}

@Override
public void close() {
heart.close();
executor.shutdownNow();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public Application<ReaperApplicationConfiguration> newApplication() {

@Override
public void after() {
context.repairManager.close();
context.isRunning.set(false);
try {
Thread.sleep(100);
Expand Down

0 comments on commit c5d3b1b

Please sign in to comment.