aboutsummaryrefslogtreecommitdiff
path: root/src/Main.java
diff options
context:
space:
mode:
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();
+ }
+ });
+
}
}