diff --git a/agent/src/main/java/io/wdd/agent/config/utils/AgentCommonThreadPool.java b/agent/src/main/java/io/wdd/agent/config/utils/AgentCommonThreadPool.java index 5754f3e..e1e3523 100644 --- a/agent/src/main/java/io/wdd/agent/config/utils/AgentCommonThreadPool.java +++ b/agent/src/main/java/io/wdd/agent/config/utils/AgentCommonThreadPool.java @@ -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() ); } diff --git a/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java b/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java index ac28ebc..2a6daef 100644 --- a/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java +++ b/agent/src/main/java/io/wdd/agent/executor/CommandExecutor.java @@ -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()