Archived
0

Zond:fix: расчет задержки запуска PingMonitor

This commit is contained in:
2017-07-24 02:02:54 +03:00
parent 149c9231ee
commit 9e63c503b9
2 changed files with 9 additions and 9 deletions

View File

@@ -1,7 +1,5 @@
package asys.zond;
import asys.zond.shell.Shell;
public class PingMonitor {
private static final long STEP_PING = 5000;
private final long delayStart;

View File

@@ -86,7 +86,7 @@ public class ZondCommandHandler implements CommandHandler {
do {
int code = 0;
long deadTime = System.currentTimeMillis() + delay;
long deadTime = 0;
try {
server = new Server();
@@ -99,6 +99,7 @@ public class ZondCommandHandler implements CommandHandler {
flagForceRestartProcess = true;
killProcess();
});
deadTime = (System.currentTimeMillis()/1000) + delay;
code = executor.execute(commandLine);
} catch (ExecuteException e) {
code = e.getExitValue();
@@ -106,14 +107,19 @@ public class ZondCommandHandler implements CommandHandler {
Shell.getInstance().getOutput().println("Exception message: " + e.getMessage());
code = -99;
}
long currTime = System.currentTimeMillis()/1000;
server.shutdown();
pingMonitor.stop();
server = null;
Shell.getInstance().getOutput().println("Process finished. Code: " + code);
if (!pingMonitor.isCorrectShutdown()) {
if (System.currentTimeMillis() <= deadTime && !flagManualKill) {
if (pingMonitor.isCorrectShutdown()) {
flagForceRestartProcess = false;
_try = 0;
break;
} else {
if (currTime <= deadTime && !flagManualKill) {
Shell.getInstance().getOutput().println("[!] Premature end process.");
_try++;
if (_try < 2) {
@@ -128,10 +134,6 @@ public class ZondCommandHandler implements CommandHandler {
} else {
break;
}
} else {
flagForceRestartProcess = false;
_try = 0;
break;
}
} while (_try < 2);