[ Service ] [ Executor ] 修改OctopusObjectMapper

This commit is contained in:
zeaslity
2023-08-11 15:47:54 +08:00
parent 06170c1024
commit 0a78f9a02b
15 changed files with 175 additions and 152 deletions

View File

@@ -12,6 +12,8 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import static io.wdd.rpc.message.handler.sync.OMessageHandler.StopWaitingResult;
import static io.wdd.rpc.message.handler.sync.OMessageHandler.WaitFromAgent;
import static io.wdd.rpc.status.CommonAndStatusCache.ALL_AGENT_TOPIC_NAME_SET;
@Service
@@ -51,18 +53,26 @@ public class ExecutionServiceImpl implements ExecutionService {
// send the message
oMessageToAgentSender.send(octopusMessage);
System.out.println("originOctopusMessage = " + octopusMessage.hashCode());
// 需要返回结果
if (!durationTask) {
// 等待结果
WaitFromAgent(octopusMessage);
synchronized (octopusMessage) {
try {
octopusMessage.wait(10000);
log.debug("等待结束!");
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
// 转换结果
commandResultLog = (ArrayList<String>) octopusMessage.getResult();
@@ -76,6 +86,9 @@ public class ExecutionServiceImpl implements ExecutionService {
}
// 释放等待队列
StopWaitingResult(octopusMessage);
return commandResultLog;
}
@@ -85,7 +98,7 @@ public class ExecutionServiceImpl implements ExecutionService {
return OctopusMessage
.builder()
.octopusMessageType(OctopusMessageType.EXECUTOR)
.init_time(TimeUtils.currentFormatTime())
.init_time(TimeUtils.currentTime())
.uuid(agentTopicName)
.content(
executionMessage