diff options
author | Jorge Hernandez <jorge.hernandez-herrero@att.com> | 2021-08-12 13:20:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-08-12 13:20:09 +0000 |
commit | 9796dd1e99aea6768a8ed9bf11557db0c2a9c210 (patch) | |
tree | 4b8b5792b09b2b90e4441e0970e6380cd99fc649 /participant/participant-intermediary/src/main | |
parent | 6e32afc478eaf9562f401d38bbdd2325adbc0281 (diff) | |
parent | 5ef27f47a82c49cbb131dc0ff0ea279fe335e113 (diff) |
Merge "Fix ParticipantStatus message in Control Loop and Participants"
Diffstat (limited to 'participant/participant-intermediary/src/main')
2 files changed, 12 insertions, 16 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java index 3ff420ffa..990c3df7d 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java @@ -21,22 +21,16 @@ package org.onap.policy.clamp.controlloop.participant.intermediary.comm; import java.io.Closeable; -import java.time.Instant; -import java.util.LinkedHashMap; -import java.util.Map; import java.util.TimerTask; -import java.util.UUID; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener; @@ -70,7 +64,7 @@ public class MessageSender extends TimerTask implements Closeable { // Kick off the timer timerPool = makeTimerPool(); - timerPool.scheduleAtFixedRate(this, 0, interval, TimeUnit.MILLISECONDS); + timerPool.scheduleAtFixedRate(this, interval, interval, TimeUnit.MILLISECONDS); } @Override diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java index 6a0e758dd..80c40683a 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java @@ -21,6 +21,7 @@ package org.onap.policy.clamp.controlloop.participant.intermediary.handler; import java.io.Closeable; +import java.time.Instant; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; @@ -32,16 +33,13 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopAck; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatusReq; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate; @@ -90,6 +88,10 @@ public class ParticipantHandler implements Closeable { parameters.getIntermediaryParameters().getReportingTimeIntervalMs()); this.controlLoopHandler = new ControlLoopHandler(parameters.getIntermediaryParameters(), sender); this.participantStatistics = new ParticipantStatistics(); + this.participantStatistics.setParticipantId(participantId); + this.participantStatistics.setState(state); + this.participantStatistics.setHealthStatus(healthStatus); + this.participantStatistics.setTimeStamp(Instant.now()); } @Override @@ -103,12 +105,7 @@ public class ParticipantHandler implements Closeable { * @param participantStatusReqMsg participant participantStatusReq message */ public void handleParticipantStatusReq(final ParticipantStatusReq participantStatusReqMsg) { - ParticipantStatus participantStatus = new ParticipantStatus(); - participantStatus.setParticipantId(participantId); - participantStatus.setParticipantStatistics(participantStatistics); - participantStatus.setParticipantType(participantType); - participantStatus.setHealthStatus(healthStatus); - sender.sendParticipantStatus(participantStatus); + sender.sendParticipantStatus(makeHeartbeat()); } /** @@ -270,11 +267,16 @@ public class ParticipantHandler implements Closeable { * Method to send heartbeat to controlloop runtime. */ public ParticipantStatus makeHeartbeat() { + this.participantStatistics.setState(state); + this.participantStatistics.setHealthStatus(healthStatus); + this.participantStatistics.setTimeStamp(Instant.now()); + ParticipantStatus heartbeat = new ParticipantStatus(); heartbeat.setParticipantId(participantId); heartbeat.setParticipantStatistics(participantStatistics); heartbeat.setParticipantType(participantType); heartbeat.setHealthStatus(healthStatus); + heartbeat.setState(state); return heartbeat; } } |