aboutsummaryrefslogtreecommitdiffstats
path: root/participant
diff options
context:
space:
mode:
Diffstat (limited to 'participant')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java20
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;
}
}