[agent][executor]- 优化command executor的代码

This commit is contained in:
zeaslity
2023-02-25 17:02:21 +08:00
parent 8187fe7baa
commit 511cfd97f6
2 changed files with 6 additions and 3 deletions

View File

@@ -71,15 +71,18 @@ public class OctopusAgentInitService {
)
public void ReceiveInitInfoFromServer(Message message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
OctopusMessage octopusMessage;
try {
OctopusMessage octopusMessage = objectMapper.readValue(message.getBody(), OctopusMessage.class);
octopusMessage = objectMapper.readValue(message.getBody(), OctopusMessage.class);
// consider the multi-agents register situation
// judge the machineID begin
String[] split = octopusMessage.getUuid().split("-");
if (!agentServerInfo.getMachineId().startsWith(split[split.length - 1])) {
throw new MyRuntimeException("INIT Message not for this agent !");
String s = "INIT Message not for this agent !";
log.error(s);
throw new MyRuntimeException(s);
}
// response chain to handle all kind of type of octopus message

View File

@@ -203,7 +203,7 @@ public class ServerCacheAgentStatus {
// Trigger调用Agent Metric 任务
ArrayList<String> allHealthyAgentTopicNames = new ArrayList<>(32);
for (int i = 0; i < statusList.size(); i++) {
if (statusList
if (null !=statusList.get(i) && statusList
.get(i)
.equals("1")) {
allHealthyAgentTopicNames.add(ALL_AGENT_TOPIC_NAME_LIST.get(i));