⚡ 修改配置.
This commit is contained in:
@@ -179,9 +179,9 @@ public class ExecCommandHandler implements IExecCommandHandler {
|
||||
return;
|
||||
}
|
||||
this.closed = true;
|
||||
Streams.close(logOutputStream);
|
||||
Streams.close(executor);
|
||||
Streams.close(sessionStore);
|
||||
Streams.close(logOutputStream);
|
||||
execLogManager.asyncCloseTailFile(execHostCommand.getLogPath());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 命令执行任务
|
||||
@@ -40,7 +39,7 @@ public class ExecTaskHandler implements IExecTaskHandler {
|
||||
private TimeoutChecker<TimeoutEndpoint> timeoutChecker;
|
||||
|
||||
@Getter
|
||||
private List<IExecCommandHandler> handlers;
|
||||
private final List<IExecCommandHandler> handlers;
|
||||
|
||||
public ExecTaskHandler(ExecCommandDTO execCommand) {
|
||||
this.execCommand = execCommand;
|
||||
@@ -93,11 +92,13 @@ public class ExecTaskHandler implements IExecTaskHandler {
|
||||
}
|
||||
if (hosts.size() == 1) {
|
||||
// 单个主机直接执行
|
||||
new ExecCommandHandler(hosts.get(0), timeoutChecker).run();
|
||||
ExecCommandHandler handler = new ExecCommandHandler(hosts.get(0), timeoutChecker);
|
||||
handlers.add(handler);
|
||||
handler.run();
|
||||
} else {
|
||||
this.handlers = hosts.stream()
|
||||
hosts.stream()
|
||||
.map(s -> new ExecCommandHandler(s, timeoutChecker))
|
||||
.collect(Collectors.toList());
|
||||
.forEach(handlers::add);
|
||||
// 多个主机异步阻塞执行
|
||||
Threads.blockRun(handlers, AssetThreadPools.EXEC_HOST);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ public interface LogConst {
|
||||
|
||||
int TRACKER_DELAY_MS = 200;
|
||||
|
||||
int TRACKER_WAIT_TIMES = 10;
|
||||
int TRACKER_WAIT_TIMES = 100;
|
||||
|
||||
}
|
||||
|
||||
@@ -55,10 +55,11 @@ public class ExecLogTracker implements IExecLogTracker {
|
||||
tracker.notFoundMode(FileNotFoundMode.WAIT_COUNT, LogConst.TRACKER_WAIT_TIMES);
|
||||
// 开始监听文件
|
||||
tracker.run();
|
||||
// 监听完成回调
|
||||
this.close = true;
|
||||
} catch (Exception e) {
|
||||
log.error("exec log tracker error path: {}", absolutePath, e);
|
||||
} finally {
|
||||
// 释放资源
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user