aboutsummaryrefslogtreecommitdiff
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
parentf1096076fd6ce8f998317d9bb531e39a76ed0d4f (diff)
downloadtrackermap-server-88544e0f367a5ab5a3522ef9cea1f78fda19d7da.tar.gz
trackermap-server-88544e0f367a5ab5a3522ef9cea1f78fda19d7da.tar.bz2
trackermap-server-88544e0f367a5ab5a3522ef9cea1f78fda19d7da.zip
Added shutdown hook
-rw-r--r--default.cfg10
-rw-r--r--nbproject/project.properties6
-rw-r--r--opengts.cfg6
-rw-r--r--src/Main.java14
4 files changed, 24 insertions, 12 deletions
diff --git a/default.cfg b/default.cfg
index 3c432d092..77312d588 100644
--- a/default.cfg
+++ b/default.cfg
@@ -75,7 +75,7 @@
extended_info - String (XML)
<-->
<entry key="database.insertPosition">
- INSERT INTO positions (device_id, time, is_valid, latitude, longitude, speed, course, power)
+ INSERT INTO positions (device_id, time, valid, latitude, longitude, speed, course, power)
VALUES (:device_id, :time, :valid, :latitude, :longitude, :speed, :course, :power)
</entry>
@@ -84,7 +84,7 @@
<entry key="http.port">8082</entry>
<!-- Logging options -->
- <entry key="logger.enable">false</entry>
+ <entry key="logger.enable">true</entry>
<entry key="logger.file">/home/user/Documents/tracker-server.log</entry>
<!-- Xexun server configuration -->
@@ -123,8 +123,8 @@
<entry key="xexun2.resetDelay">0</entry>
<!-- AVL-08 server configuration -->
- <entry key="xexun2.enable">true</entry>
- <entry key="xexun2.port">5007</entry>
- <entry key="xexun2.resetDelay">0</entry>
+ <entry key="avl08.enable">true</entry>
+ <entry key="avl08.port">5007</entry>
+ <entry key="avl08.resetDelay">0</entry>
</properties>
diff --git a/nbproject/project.properties b/nbproject/project.properties
index aed63160a..98bd4fb1e 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -33,7 +33,7 @@ file.reference.jetty-io-8.1.3.v20120416.jar=/home/user/Documents/lib/jetty/jetty
file.reference.jetty-server-8.1.3.v20120416.jar=/home/user/Documents/lib/jetty/jetty-server-8.1.3.v20120416.jar
file.reference.jetty-util-8.1.3.v20120416.jar=/home/user/Documents/lib/jetty/jetty-util-8.1.3.v20120416.jar
file.reference.junit-4.10.jar=/home/user/Documents/lib/junit-4.10.jar
-file.reference.mysql-connector-java-5.1.19-bin.jar=/home/user/Documents/lib/mysql-connector-java-5.1.19-bin.jar
+file.reference.mysql-connector-java-5.1.20-bin.jar=/home/user/Documents/lib/mysql-connector-java-5.1.20-bin.jar
file.reference.netty-3.4.1.Final.jar=/home/user/Documents/lib/netty-3.4.1.Final.jar
file.reference.servlet-api-3.0.jar=/home/user/Documents/lib/jetty/servlet-api-3.0.jar
includes=**
@@ -42,14 +42,14 @@ jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.netty-3.4.1.Final.jar}:\
- ${file.reference.mysql-connector-java-5.1.19-bin.jar}:\
${file.reference.h2-1.3.166.jar}:\
${file.reference.jetty-http-8.1.3.v20120416.jar}:\
${file.reference.jetty-io-8.1.3.v20120416.jar}:\
${file.reference.jetty-server-8.1.3.v20120416.jar}:\
${file.reference.jetty-util-8.1.3.v20120416.jar}:\
${file.reference.servlet-api-3.0.jar}:\
- ${file.reference.jetty-continuation-8.1.3.v20120416.jar}
+ ${file.reference.jetty-continuation-8.1.3.v20120416.jar}:\
+ ${file.reference.mysql-connector-java-5.1.20-bin.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=true
diff --git a/opengts.cfg b/opengts.cfg
index 40f535723..11dbbbb2f 100644
--- a/opengts.cfg
+++ b/opengts.cfg
@@ -84,8 +84,8 @@
<entry key="xexun2.resetDelay">0</entry>
<!-- AVL-08 server configuration -->
- <entry key="xexun2.enable">true</entry>
- <entry key="xexun2.port">5007</entry>
- <entry key="xexun2.resetDelay">0</entry>
+ <entry key="avl08.enable">true</entry>
+ <entry key="avl08.port">5007</entry>
+ <entry key="avl08.resetDelay">0</entry>
</properties>
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();
+ }
+ });
+
}
}