[agent][executor]- bug - 6

This commit is contained in:
zeaslity
2023-02-25 22:50:40 +08:00
parent 7e02d4c3fd
commit deab8fff43
2 changed files with 12 additions and 11 deletions

View File

@@ -8,7 +8,6 @@ public class AgentCommonThreadPool {
public static ExecutorService pool;
static {
ThreadFactory threadFactory = new ThreadFactoryBuilder()
@@ -19,13 +18,14 @@ public class AgentCommonThreadPool {
// construct the thread pool
pool = new ThreadPoolExecutor(
5,
10,
30,
500,
TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<>(8,true),
new ArrayBlockingQueue<>(32,
true),
threadFactory,
new ThreadPoolExecutor.AbortPolicy()
new ThreadPoolExecutor.DiscardPolicy()
);
}

View File

@@ -134,8 +134,14 @@ public class CommandExecutor {
octopusMessage
));
// 缓存 命令处理日志
commandExecLogCache.cacheLog(
streamKey,
process
);
// 等待1秒钟, 使得有时间进行后端任务的完成
TimeUnit.SECONDS.sleep(1);
//TimeUnit.SECONDS.sleep(1);
// get the command result must also be a timeout smaller than the process
// 此处会把主线程卡死, forever终结
@@ -187,11 +193,6 @@ public class CommandExecutor {
System.out.println("process isAlive = " + process.isAlive());
// 缓存 命令处理日志
commandExecLogCache.cacheLog(
streamKey,
process
);
// 任务提前执行结束,或者超过了最长等待时间
// 判断命令是否正确处理完成
@@ -253,7 +254,7 @@ public class CommandExecutor {
// 执行到这里,说明整个任务流程结束
log.debug(
"命令 [ {} ]执行全流程结束!",
"命令 [ {} ] 执行全流程结束!",
process
.info()
.commandLine()