X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ECOMP-PDP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fpdp%2Frest%2Fjmx%2FPdpRestMonitor.java;h=1c088b24e7845ae3c3427983d9d1437921f8b734;hb=d9007d680d19734d5dc106479784c420236cca4b;hp=93dfbe6a016908c8adce2b2aa39774665e936959;hpb=91d04c64771832a0b8815ffbe1f0f9920320d94d;p=policy%2Fengine.git diff --git a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/jmx/PdpRestMonitor.java b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/jmx/PdpRestMonitor.java index 93dfbe6a0..1c088b24e 100644 --- a/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/jmx/PdpRestMonitor.java +++ b/ECOMP-PDP-REST/src/main/java/org/openecomp/policy/pdp/rest/jmx/PdpRestMonitor.java @@ -22,18 +22,14 @@ package org.openecomp.policy.pdp.rest.jmx; import java.util.HashMap; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.BinaryOperator; import org.openecomp.policy.xacml.util.MetricsUtil.AvgLatency; import org.openecomp.policy.xacml.util.MetricsUtil.MaxLatency; import org.openecomp.policy.xacml.util.MetricsUtil.MinLatency; public class PdpRestMonitor implements PdpRestMonitorMBean { - public static PdpRestMonitor singleton = new PdpRestMonitor(); + private static PdpRestMonitor singleton = new PdpRestMonitor(); private final AtomicLong pdpEvaluationAttempts = new AtomicLong(); private final AtomicLong pdpEvaluationSuccesses = new AtomicLong(); @@ -140,22 +136,27 @@ public class PdpRestMonitor implements PdpRestMonitorMBean { } public void policyCountAdd(String policyID, Integer count){ + int countValue = count; if (policyCount.containsKey(policyID)){ - count = count + policyCount.get(policyID); + countValue = countValue + policyCount.get(policyID); } - policyCount.put(policyID, count); + policyCount.put(policyID, countValue); } public Map getpolicyMap() { return policyCount; } public Integer getpolicyCount(String policyID) { - // TODO Auto-generated method stub if (policyCount.containsKey(policyID)){ return policyCount.get(policyID); } return null; } - + public static PdpRestMonitor getSingleton() { + return singleton; + } + public static void setSingleton(PdpRestMonitor singleton) { + PdpRestMonitor.singleton = singleton; + } }