aboutsummaryrefslogtreecommitdiff
path: root/src/Main.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-05-07 17:11:08 +0400
committerAnton Tananaev <anton.tananaev@gmail.com>2012-05-07 17:11:08 +0400
commit88544e0f367a5ab5a3522ef9cea1f78fda19d7da (patch)
tree3e10f418e9015500693698e7e29e7edb24762e3f /src/Main.java
parentf1096076fd6ce8f998317d9bb531e39a76ed0d4f (diff)
downloadtrackermap-server-88544e0f367a5ab5a3522ef9cea1f78fda19d7da.tar.gz
trackermap-server-88544e0f367a5ab5a3522ef9cea1f78fda19d7da.tar.bz2
trackermap-server-88544e0f367a5ab5a3522ef9cea1f78fda19d7da.zip
Added shutdown hook
Diffstat (limited to 'src/Main.java')
-rw-r--r--src/Main.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Main.java b/src/Main.java
index a60d0661f..d8a3b397c 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -4,8 +4,20 @@ public class Main {
public static void main(String[] args) throws Exception {
- Server service = new Server();
+ final Server service = new Server();
service.init(args);
+
+ System.out.println("starting server...");
service.start();
+
+ // Shutdown server properly
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ System.out.println("shutting down server...");
+ service.stop();
+ }
+ });
+
}
}