From efaa2f3f7d22a5096625b51643f707b471569d78 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 16 Jul 2021 10:04:54 -0400 Subject: Use lombok annotations in gui Issue-ID: POLICY-3395 Change-Id: I7820877522875a3caf47e3b7409eb4f7fb15ba2b Signed-off-by: Jim Hahn --- .../onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java | 15 +-------------- .../pdp/monitoring/rest/PdpMonitoringRestResource.java | 12 +++--------- 2 files changed, 4 insertions(+), 23 deletions(-) (limited to 'gui-pdp-monitoring') diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java index 385e2b5..398cbc4 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java @@ -105,7 +105,7 @@ public class PdpMonitoringMain { pdpMonitoringServer = new PdpMonitoringServer(parameters); // Add a shutdown hook to shut down the servlet services when the process is exiting - Runtime.getRuntime().addShutdownHook(new Thread(new PdpServicesShutdownHook())); + Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown)); state = ServicesState.RUNNING; @@ -159,19 +159,6 @@ public class PdpMonitoringMain { LOGGER.info(PDP_MONITORING_PREFIX + "{}) shutting down", this); } - /** - * This class is a shutdown hook for the Pdp services command. - */ - private class PdpServicesShutdownHook implements Runnable { - /** - * {@inheritDoc}. - */ - @Override - public void run() { - shutdown(); - } - } - /** * Main method, main entry point for command. * diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java index ede9bee..6075049 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java @@ -38,6 +38,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; @@ -243,15 +244,12 @@ public class PdpMonitoringRestResource { * A list of values that uses a FIFO sliding window of a fixed size. */ @EqualsAndHashCode(callSuper = true) + @AllArgsConstructor public class SlidingWindowList extends LinkedList { private static final long serialVersionUID = -7187277916025957447L; private final int maxEntries; - public SlidingWindowList(final int maxEntries) { - this.maxEntries = maxEntries; - } - @Override public boolean add(final V elm) { if (this.size() > (maxEntries - 1)) { @@ -265,14 +263,10 @@ public class PdpMonitoringRestResource { * A class used to storing a single data entry for an engine. */ @Getter + @AllArgsConstructor public class Counter { private final long timestamp; private final long value; - - public Counter(final long timestamp, final long value) { - this.timestamp = timestamp; - this.value = value; - } } } -- cgit 1.2.3-korg