[ server ] [ executor ] - redis stream listener container all procedure

This commit is contained in:
zeaslity
2022-12-30 14:40:21 +08:00
parent 0c2549eb34
commit d9a70aa059
4 changed files with 45 additions and 14 deletions

View File

@@ -81,7 +81,7 @@ public class CommandExecutor {
));
// cache log lines
logToArrayListCache.cacheLog(streamKey, process.getInputStream());
logToArrayListCache.cacheLog(streamKey, process);
// start to send the result log
streamSender.startToWaitLog(streamKey);

View File

@@ -27,6 +27,21 @@ public class LogToArrayListCache {
new ArrayList<>(256)
);
public void cacheLog(String streamKey, Process process) {
ArrayList<String> commandCachedLog = this.getExecutionCmdCachedLogArrayList(streamKey);
String format = String.format("execution command are => [ %s ]", process.info().commandLine().get());
// add the command
commandCachedLog.add(format);
commandCachedLog.add("--------------- command result are as below --------------------");
commandCachedLog.add("");
// cache the real command logs
cacheLog(streamKey, process.getInputStream());
}
public void cacheLog(String streamKey, InputStream commandLogStream) {
ArrayList<String> commandCachedLog = this.getExecutionCmdCachedLogArrayList(streamKey);