[agent][executor]- bug - 6
This commit is contained in:
@@ -8,7 +8,6 @@ public class AgentCommonThreadPool {
|
|||||||
|
|
||||||
public static ExecutorService pool;
|
public static ExecutorService pool;
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
||||||
@@ -19,13 +18,14 @@ public class AgentCommonThreadPool {
|
|||||||
|
|
||||||
// construct the thread pool
|
// construct the thread pool
|
||||||
pool = new ThreadPoolExecutor(
|
pool = new ThreadPoolExecutor(
|
||||||
5,
|
|
||||||
10,
|
10,
|
||||||
|
30,
|
||||||
500,
|
500,
|
||||||
TimeUnit.MILLISECONDS,
|
TimeUnit.MILLISECONDS,
|
||||||
new ArrayBlockingQueue<>(8,true),
|
new ArrayBlockingQueue<>(32,
|
||||||
|
true),
|
||||||
threadFactory,
|
threadFactory,
|
||||||
new ThreadPoolExecutor.AbortPolicy()
|
new ThreadPoolExecutor.DiscardPolicy()
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,8 +134,14 @@ public class CommandExecutor {
|
|||||||
octopusMessage
|
octopusMessage
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// 缓存 命令处理日志
|
||||||
|
commandExecLogCache.cacheLog(
|
||||||
|
streamKey,
|
||||||
|
process
|
||||||
|
);
|
||||||
|
|
||||||
// 等待1秒钟, 使得有时间进行后端任务的完成
|
// 等待1秒钟, 使得有时间进行后端任务的完成
|
||||||
TimeUnit.SECONDS.sleep(1);
|
//TimeUnit.SECONDS.sleep(1);
|
||||||
|
|
||||||
// get the command result must also be a timeout smaller than the process
|
// get the command result must also be a timeout smaller than the process
|
||||||
// 此处会把主线程卡死, forever终结
|
// 此处会把主线程卡死, forever终结
|
||||||
@@ -187,11 +193,6 @@ public class CommandExecutor {
|
|||||||
|
|
||||||
System.out.println("process isAlive = " + process.isAlive());
|
System.out.println("process isAlive = " + process.isAlive());
|
||||||
|
|
||||||
// 缓存 命令处理日志
|
|
||||||
commandExecLogCache.cacheLog(
|
|
||||||
streamKey,
|
|
||||||
process
|
|
||||||
);
|
|
||||||
|
|
||||||
// 任务提前执行结束,或者超过了最长等待时间
|
// 任务提前执行结束,或者超过了最长等待时间
|
||||||
// 判断命令是否正确处理完成
|
// 判断命令是否正确处理完成
|
||||||
@@ -253,7 +254,7 @@ public class CommandExecutor {
|
|||||||
|
|
||||||
// 执行到这里,说明整个任务流程结束
|
// 执行到这里,说明整个任务流程结束
|
||||||
log.debug(
|
log.debug(
|
||||||
"命令 [ {} ]执行全流程结束!",
|
"命令 [ {} ] 执行全流程结束!",
|
||||||
process
|
process
|
||||||
.info()
|
.info()
|
||||||
.commandLine()
|
.commandLine()
|
||||||
|
|||||||
Reference in New Issue
Block a user