diff options
author | ezhil <ezhrajam@in.ibm.com> | 2018-12-05 20:33:08 +0530 |
---|---|---|
committer | Ezhilarasi R <ezhrajam@in.ibm.com> | 2018-12-05 15:21:11 +0000 |
commit | 72504e5853929bd0d649fc3bc42d3e91fc60c079 (patch) | |
tree | 12566692ebf4ff785d3fc22353ba17d40def0075 /dblib/provider/src/main/java | |
parent | 72878d5a7aa2e830e4c08743005dc00613d26938 (diff) |
Fixed sonar issues in PollingWorker.java
Fixed logger issues
Issue-ID: CCSDK-791
Change-Id: Ie1759c8778ff896b2cff3e187308e6a10265e966
Signed-off-by: ezhil <ezhrajam@in.ibm.com>
Diffstat (limited to 'dblib/provider/src/main/java')
-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 4bfa058a8..b44e2f89d 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{ |