diff options
Diffstat (limited to 'participant/participant-intermediary/src/main')
2 files changed, 12 insertions, 13 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 7aa89be51..e1c0f7c46 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; @@ -87,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 @@ -100,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()); } /** @@ -267,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; } } |