Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.

Commit 04bbf17

Browse files
committed
Shutdown signal listener
1 parent b2cdf00 commit 04bbf17

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/br/registro/dnsshim/xfrd/server/XfrdLauncher.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ public static void main(String[] args) {
7979
SlaveGroupDumperManager.launch();
8080
DnsshimSessionCollectorManager.launch();
8181

82+
final Thread mainThread = Thread.currentThread();
83+
Runtime.getRuntime().addShutdownHook(new Thread() {
84+
public void run() {
85+
SHUTDOWN = true;
86+
try {
87+
logger.info("Shutdown signal received");
88+
mainThread.join();
89+
} catch (InterruptedException e) {
90+
// TODO Auto-generated catch block
91+
e.printStackTrace();
92+
}
93+
}
94+
});
95+
8296
while (SHUTDOWN == false) {
8397
try {
8498
Thread.sleep(5000);

0 commit comments

Comments
 (0)