Skip to content

Commit

Permalink
Removed ad-hoc shutdown hook - need more order (coming (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Aug 29, 2023
1 parent 9905ee3 commit ebfdd90
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions dz3r-director/src/main/java/net/sf/dz3r/model/UnitDirector.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,11 @@ public UnitDirector(
.subscribeOn(Schedulers.boundedElastic())
.subscribe());

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
ThreadContext.push("shutdownHook");
try {

logger.warn("Received termination signal {}", getAddress());
sigTerm.countDown();
logger.warn("Shutting down: {}", getAddress());
try {
shutdownComplete.await();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
logger.error("Interrupted, can do nothing about it", ex);
}
logger.info("Shut down: {}", getAddress());

} finally {
ThreadContext.pop();
}
}));

logger.info("Configured: {} ({} zones: {})",
name,
zones.size(),
Flux.fromIterable(zones)
.map(z -> z.getAddress())
.map(Zone::getAddress)
.sort()
.collectList()
.block());
Expand Down

0 comments on commit ebfdd90

Please sign in to comment.