提交 3612ca70 编写于 作者: O o2sword

增加restart命令3

上级 69a79274
...@@ -451,7 +451,7 @@ public class Main { ...@@ -451,7 +451,7 @@ public class Main {
if(file.exists()) { if(file.exists()) {
System.out.println("server will start in new process!"); System.out.println("server will start in new process!");
Process ps = Runtime.getRuntime().exec(file.getAbsolutePath()); Process ps = Runtime.getRuntime().exec(file.getAbsolutePath());
Thread.sleep(1000); Thread.sleep(2000);
if(!Config.currentNode().autoStart()) { if(!Config.currentNode().autoStart()) {
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
try (Socket socket = new Socket(Config.node(), Config.currentNode().nodeAgentPort())) { try (Socket socket = new Socket(Config.node(), Config.currentNode().nodeAgentPort())) {
...@@ -485,14 +485,6 @@ public class Main { ...@@ -485,14 +485,6 @@ public class Main {
} }
private static void stopAllThreads(){ private static void stopAllThreads(){
if(nodeAgent!=null){
try {
nodeAgent.stopAgent();
nodeAgent.interrupt();
nodeAgent = null;
} catch (Exception e) {
}
}
if(swapCommandThread!=null){ if(swapCommandThread!=null){
try { try {
swapCommandThread.interrupt(); swapCommandThread.interrupt();
...@@ -505,6 +497,18 @@ public class Main { ...@@ -505,6 +497,18 @@ public class Main {
} catch (Exception e) { } catch (Exception e) {
} }
} }
if(nodeAgent!=null){
try {
nodeAgent.stopAgent();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
nodeAgent.interrupt();
nodeAgent = null;
} catch (Exception e) {
}
}
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册