[agent][executor]- bug
This commit is contained in:
@@ -105,6 +105,7 @@ public class CommandExecutor {
|
|||||||
// 开始执行命令操作
|
// 开始执行命令操作
|
||||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
|
// 开始执行命令操作
|
||||||
Process process = processBuilder.start();
|
Process process = processBuilder.start();
|
||||||
|
|
||||||
// 守护进程 对每一条任务的超时时间进行限制,避免卡死
|
// 守护进程 对每一条任务的超时时间进行限制,避免卡死
|
||||||
@@ -116,8 +117,6 @@ public class CommandExecutor {
|
|||||||
commandExecWaitTimeout = durationTaskMaxWaitSeconds;
|
commandExecWaitTimeout = durationTaskMaxWaitSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 2023年2月23日 同时执行log日志部分移动至此部分处理
|
// 2023年2月23日 同时执行log日志部分移动至此部分处理
|
||||||
AgentCommonThreadPool.pool.submit(
|
AgentCommonThreadPool.pool.submit(
|
||||||
DaemonCommandProcessAndCollectLog(
|
DaemonCommandProcessAndCollectLog(
|
||||||
@@ -137,7 +136,6 @@ public class CommandExecutor {
|
|||||||
|
|
||||||
// 命令执行完成, countDownLatch计数
|
// 命令执行完成, countDownLatch计数
|
||||||
countDownLatch.countDown();
|
countDownLatch.countDown();
|
||||||
|
|
||||||
// 设置 命令执行退出返回值
|
// 设置 命令执行退出返回值
|
||||||
processResult = process.exitValue();
|
processResult = process.exitValue();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.wdd.agent.executor.thread;
|
|||||||
|
|
||||||
import io.wdd.common.utils.TimeUtils;
|
import io.wdd.common.utils.TimeUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@@ -37,7 +38,15 @@ public class CommandExecLogCache {
|
|||||||
*/
|
*/
|
||||||
public void cacheLog(String streamKey, Process process) {
|
public void cacheLog(String streamKey, Process process) {
|
||||||
|
|
||||||
Assert.notNull(process,"命令执行为空!");
|
log.debug(
|
||||||
|
"开始缓存命令执行日志! process is {}",
|
||||||
|
process
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ObjectUtils.isEmpty(process)) {
|
||||||
|
log.error("process is null ! cache log error !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<String> commandCachedLog = new ArrayList<>(128);
|
ArrayList<String> commandCachedLog = new ArrayList<>(128);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user