Java 17 Upgrade
[policy/models.git] / models-sim / policy-models-sim-pdp / src / main / java / org / onap / policy / models / sim / pdp / comm / PdpStatusPublisher.java
index b64967f..69b25dd 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Nordix Foundation.
+ *  Copyright (C) 2019, 2023 Nordix Foundation.
+ *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@ package org.onap.policy.models.sim.pdp.comm;
 import java.util.List;
 import java.util.Timer;
 import java.util.TimerTask;
+import lombok.Getter;
 import org.onap.policy.common.endpoints.event.comm.TopicSink;
 import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
 import org.onap.policy.models.pdp.concepts.PdpStatus;
@@ -39,9 +41,10 @@ public class PdpStatusPublisher extends TimerTask {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(PdpStatusPublisher.class);
 
-    private TopicSinkClient topicSinkClient;
-    private Timer timer;
-    private long interval;
+    private final TopicSinkClient topicSinkClient;
+    private final Timer timer;
+    @Getter
+    private final long interval;
 
     /**
      * Constructor for instantiating PdpStatusPublisher.
@@ -58,7 +61,7 @@ public class PdpStatusPublisher extends TimerTask {
 
     @Override
     public void run() {
-        final PdpStatus pdpStatus = new PdpMessageHandler().createPdpStatusFromContext();
+        final var pdpStatus = new PdpMessageHandler().createPdpStatusFromContext();
         topicSinkClient.send(pdpStatus);
         LOGGER.debug("Sent heartbeat to PAP - {}", pdpStatus);
     }
@@ -71,15 +74,6 @@ public class PdpStatusPublisher extends TimerTask {
         timer.purge();
     }
 
-    /**
-     * Get the current time interval used by the timer task.
-     *
-     * @return interval the current time interval
-     */
-    public long getInterval() {
-        return interval;
-    }
-
     /**
      * Method to send pdp status message to pap on demand.
      *