diff options
author | Dan Timoney <dtimoney@att.com> | 2018-12-11 15:07:42 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-11 15:07:42 +0000 |
commit | 4a00849be4beb0c4258d8299709ed10827fcd19a (patch) | |
tree | c8b29d1511843cf28df50913903a2708f9f518f2 /dblib/provider/src | |
parent | d1cd3c2fc3df0b21263928058a332208942eff18 (diff) | |
parent | 72504e5853929bd0d649fc3bc42d3e91fc60c079 (diff) |
Merge "Fixed sonar issues in PollingWorker.java"
Diffstat (limited to 'dblib/provider/src')
-rw-r--r-- | dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/pm/PollingWorker.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/pm/PollingWorker.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/pm/PollingWorker.java index 4bfa058a..b44e2f89 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/pm/PollingWorker.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/pm/PollingWorker.java @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicLong; public class PollingWorker implements Runnable { - private Logger LOGGER = LoggerFactory.getLogger(PollingWorker.class); + private Logger logger = LoggerFactory.getLogger(PollingWorker.class); private static PollingWorker self = null; @@ -47,17 +47,6 @@ public class PollingWorker implements Runnable { private static boolean enabled = false; private Timer timer = null; - public static void post(long starttime){ - PollingWorker temp = self; - if(temp != null && enabled) { - temp.register(new TestSample(starttime)); - } - } - - public static void createInistance(Properties props){ - self = new PollingWorker(props); - } - private PollingWorker(Properties ctxprops){ if(ctxprops==null || ctxprops.getProperty("org.onap.ccsdk.dblib.pm") == null){ enabled = false; @@ -89,6 +78,18 @@ public class PollingWorker implements Runnable { timer.schedule(new MyTimerTask(), interval*1000L, interval*1000L); } } + public static void post(long starttime){ + PollingWorker temp = self; + if(temp != null && enabled) { + temp.register(new TestSample(starttime)); + } + } + + public static void createInistance(Properties props){ + self = new PollingWorker(props); + } + + private void register(TestSample object){ try { @@ -113,12 +114,14 @@ public class PollingWorker implements Runnable { consume((TestSample)next); } else { System.out.println(next.getClass().getName()); + logger.error(next.getClass().getName()); } } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); + } } @@ -146,7 +149,7 @@ public class PollingWorker implements Runnable { } sb.append(tmp2[i].get()).append("\t"); } - LOGGER.info(sb.toString()); + logger.info(sb.toString()); } class MyTimerTask extends TimerTask{ |