diff options
3 files changed, 15 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 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; } } diff --git a/runtime/src/main/resources/logback-default.xml b/runtime/src/main/resources/logback-default.xml index f8ce5ae41..443bc0eb1 100644 --- a/runtime/src/main/resources/logback-default.xml +++ b/runtime/src/main/resources/logback-default.xml @@ -79,7 +79,7 @@ </appender> <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="org.onap.policy.clamp.clds.util.LoggerMarkerFilter$AuditLoggerMarkerFilter" /> + <filter class="org.onap.policy.common.utils.logging.LoggerMarkerFilter$AuditLoggerMarkerFilter" /> <file>${logDirectory}/audit.log</file> <encoder> <pattern>${auditPattern}</pattern> @@ -98,7 +98,7 @@ </appender> <appender name="METRIC" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="org.onap.policy.clamp.clds.util.LoggerMarkerFilter$MetricLoggerMarkerFilter" /> + <filter class="org.onap.policy.common.utils.logging.LoggerMarkerFilter$MetricLoggerMarkerFilter" /> <file>${logDirectory}/metric.log</file> <encoder> <pattern>${metricPattern}</pattern> @@ -118,7 +118,7 @@ <!-- SECURITY related loggers --> <appender name="SECURITY" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="org.onap.policy.clamp.clds.util.LoggerMarkerFilter$SecurityLoggerMarkerFilter" /> + <filter class="org.onap.policy.common.utils.logging.LoggerMarkerFilter$SecurityLoggerMarkerFilter" /> <file>${logDirectory}/security.log</file> <encoder> <pattern>%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n |