o2sword 5 лет назад
Родитель
Сommit
35e90c75ab
1 измененных файлов с 13 добавлено и 9 удалено
  1. 13 9
      o2server/x_console/src/main/java/com/x/server/console/Main.java

+ 13 - 9
o2server/x_console/src/main/java/com/x/server/console/Main.java

@@ -451,7 +451,7 @@ public class Main {
 			if(file.exists()) {
                 System.out.println("server will start in new process!");
 				Process ps = Runtime.getRuntime().exec(file.getAbsolutePath());
-				Thread.sleep(1000);
+				Thread.sleep(2000);
 				if(!Config.currentNode().autoStart()) {
 					for (int i = 0; i < 5; i++) {
 						try (Socket socket = new Socket(Config.node(), Config.currentNode().nodeAgentPort())) {
@@ -485,14 +485,6 @@ public class Main {
 	}
 
 	private static void stopAllThreads(){
-		if(nodeAgent!=null){
-			try {
-				nodeAgent.stopAgent();
-				nodeAgent.interrupt();
-				nodeAgent = null;
-			} catch (Exception e) {
-			}
-		}
 		if(swapCommandThread!=null){
 			try {
 				swapCommandThread.interrupt();
@@ -505,6 +497,18 @@ public class Main {
 			} catch (Exception e) {
 			}
 		}
+		if(nodeAgent!=null){
+			try {
+				nodeAgent.stopAgent();
+				try {
+					Thread.sleep(1000);
+				} catch (InterruptedException e) {
+				}
+				nodeAgent.interrupt();
+				nodeAgent = null;
+			} catch (Exception e) {
+			}
+		}
 
 	}