From ebfdd90788e7b412dd5a2884af3040d9a5f16db8 Mon Sep 17 00:00:00 2001 From: Vadim Tkachenko Date: Mon, 28 Aug 2023 21:00:07 -0700 Subject: [PATCH] Removed ad-hoc shutdown hook - need more order (coming (#277) --- .../java/net/sf/dz3r/model/UnitDirector.java | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/dz3r-director/src/main/java/net/sf/dz3r/model/UnitDirector.java b/dz3r-director/src/main/java/net/sf/dz3r/model/UnitDirector.java index 95014240e..4590ccc38 100644 --- a/dz3r-director/src/main/java/net/sf/dz3r/model/UnitDirector.java +++ b/dz3r-director/src/main/java/net/sf/dz3r/model/UnitDirector.java @@ -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());