[agent][executor]- bug - 5

This commit is contained in:
zeaslity
2023-02-25 22:42:43 +08:00
parent fedb3589e9
commit 29e7db26d9

View File

@@ -8,6 +8,7 @@ import io.wdd.agent.executor.thread.CommandExecLogCache;
import io.wdd.agent.message.OMessageToServerSender; import io.wdd.agent.message.OMessageToServerSender;
import io.wdd.common.beans.executor.ExecutionMessage; import io.wdd.common.beans.executor.ExecutionMessage;
import io.wdd.common.beans.rabbitmq.OctopusMessage; import io.wdd.common.beans.rabbitmq.OctopusMessage;
import io.wdd.common.handler.MyRuntimeException;
import io.wdd.common.utils.TimeUtils; import io.wdd.common.utils.TimeUtils;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -21,7 +22,9 @@ import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@Configuration @Configuration
@@ -217,7 +220,27 @@ public class CommandExecutor {
// 对线程进行debug // 对线程进行debug
commandExecLogCache.debugProcessStreams(process); commandExecLogCache.debugProcessStreams(process);
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
process.destroy(); process.destroy();
try {
Process exitProcess = process
.onExit()
.get(
commandExecWaitTimeout,
TimeUnit.SECONDS
);
commandExecLogCache.debugProcessStreams(exitProcess);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
throw new MyRuntimeException(e);
}
} }
} }