diff --git a/bin/mp.sh b/bin/mp.sh index 589412b..518fb30 100644 --- a/bin/mp.sh +++ b/bin/mp.sh @@ -231,7 +231,7 @@ upgrade) restart) shift "$0" stop ${@} - sleep 5 + sleep 1 "$0" start ${@} ;; status) diff --git a/src/main/java/com/shinemo/mpush/alloc/AllocHandler.java b/src/main/java/com/shinemo/mpush/alloc/AllocHandler.java index 2be2af7..2d8a4d8 100644 --- a/src/main/java/com/shinemo/mpush/alloc/AllocHandler.java +++ b/src/main/java/com/shinemo/mpush/alloc/AllocHandler.java @@ -62,7 +62,7 @@ public void start() { } public void stop() { - ZKClient.I.stop(); + if (ZKClient.I.isRunning()) ZKClient.I.stop(); scheduledExecutor.shutdown(); } diff --git a/src/main/java/com/shinemo/mpush/alloc/AllocServer.java b/src/main/java/com/shinemo/mpush/alloc/AllocServer.java index 2c19376..69084dc 100644 --- a/src/main/java/com/shinemo/mpush/alloc/AllocServer.java +++ b/src/main/java/com/shinemo/mpush/alloc/AllocServer.java @@ -69,9 +69,9 @@ protected void doStart(Listener listener) throws Throwable { @Override protected void doStop(Listener listener) throws Throwable { - httpServer.stop(60);//1 min - allocHandler.stop(); + httpServer.stop(0);//1 min pushHandler.stop(); + allocHandler.stop(); Logs.Console.info("==================================================================="); Logs.Console.info("====================ALLOC SERVER STOPPED SUCCESS====================="); Logs.Console.info("==================================================================="); diff --git a/src/main/java/com/shinemo/mpush/alloc/Main.java b/src/main/java/com/shinemo/mpush/alloc/Main.java index 913f370..c53aeaf 100644 --- a/src/main/java/com/shinemo/mpush/alloc/Main.java +++ b/src/main/java/com/shinemo/mpush/alloc/Main.java @@ -31,6 +31,8 @@ public final class Main { public static void main(String[] args) { + Logs.init(); + Logs.Console.info("launch alloc server..."); AllocServer server = new AllocServer(); server.start(); addHook(server);