X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fstatistics%2FStatisticsCounters.java;h=d0c071e50f8d3b7eb6f909a3ea09f1d7bea0d66c;hb=e522c58d71ba5eed20ec5199b8cad6ad22550079;hp=951969ab254492f18bd977489dba90a638cca4bf;hpb=f7f6622d4de5ea6c70a24c583d42020301b69cf3;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java index 951969ab..d0c071e5 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java @@ -11,7 +11,6 @@ import java.util.Map; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; - import org.opendaylight.openflowjava.protocol.spi.statistics.StatisticsHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,7 +31,7 @@ public final class StatisticsCounters implements StatisticsHandler { */ public static final int MINIMAL_LOG_REPORT_PERIOD = 500; private static StatisticsCounters instanceHolder; - private static final Logger LOGGER = LoggerFactory.getLogger(StatisticsCounters.class); + private static final Logger LOG = LoggerFactory.getLogger(StatisticsCounters.class); private Timer logReporter; private int logReportPeriod; @@ -41,21 +40,22 @@ public final class StatisticsCounters implements StatisticsHandler { private boolean runCounting; // array to hold enabled counter types private CounterEventTypes[] enabledCounters = { - CounterEventTypes.DS_ENCODE_FAIL, + CounterEventTypes.DS_ENCODE_FAIL, CounterEventTypes.DS_ENCODE_SUCCESS, CounterEventTypes.DS_ENTERED_OFJAVA, CounterEventTypes.DS_FLOW_MODS_ENTERED, CounterEventTypes.DS_FLOW_MODS_SENT, - CounterEventTypes.US_DECODE_FAIL, - CounterEventTypes.US_DECODE_SUCCESS, - CounterEventTypes.US_MESSAGE_PASS, + CounterEventTypes.US_DROPPED_PACKET_IN, + CounterEventTypes.US_DECODE_FAIL, + CounterEventTypes.US_DECODE_SUCCESS, + CounterEventTypes.US_MESSAGE_PASS, CounterEventTypes.US_RECEIVED_IN_OFJAVA}; /** * Get instance of statistics counters, first created object does not start counting and log reporting * @return an instance */ - public synchronized static StatisticsCounters getInstance() { + public static synchronized StatisticsCounters getInstance() { if (instanceHolder == null) { instanceHolder = new StatisticsCounters(); } @@ -70,7 +70,7 @@ public final class StatisticsCounters implements StatisticsHandler { runCounting = false; this.logReportPeriod = 0; this.runLogReport = false; - LOGGER.debug("StaticsCounters has been created"); + LOG.debug("StaticsCounters has been created"); } /** @@ -83,7 +83,7 @@ public final class StatisticsCounters implements StatisticsHandler { return; } resetCounters(); - LOGGER.debug("Counting started..."); + LOG.debug("Counting started..."); if(reportToLogs){ startLogReport(logReportDelay); } @@ -95,7 +95,7 @@ public final class StatisticsCounters implements StatisticsHandler { */ public void stopCounting(){ runCounting = false; - LOGGER.debug("Stop counting..."); + LOG.debug("Stop counting..."); stopLogReport(); } @@ -127,7 +127,7 @@ public final class StatisticsCounters implements StatisticsHandler { logReporter = new Timer("SC_Timer"); logReporter.schedule(new LogReporterTask(this), this.logReportPeriod, this.logReportPeriod); runLogReport = true; - LOGGER.debug("Statistics log reporter has been scheduled with period {} ms", this.logReportPeriod); + LOG.debug("Statistics log reporter has been scheduled with period {} ms", this.logReportPeriod); } /** @@ -137,7 +137,7 @@ public final class StatisticsCounters implements StatisticsHandler { if(runLogReport){ if(logReporter != null){ logReporter.cancel(); - LOGGER.debug("Statistics log reporter has been canceled"); + LOG.debug("Statistics log reporter has been canceled"); } runLogReport = false; } @@ -186,8 +186,8 @@ public final class StatisticsCounters implements StatisticsHandler { /** * Get counter by CounterEventType * @param counterEventKey key to identify counter (can not be null) - * @return - Counter object or null if counter has not been enabled - * @exception - IllegalArgumentException if counterEventKey is null + * @return Counter object or null if counter has not been enabled + * @throws IllegalArgumentException if counterEventKey is null */ public Counter getCounter(CounterEventTypes counterEventKey) { if (counterEventKey == null) { @@ -213,7 +213,7 @@ public final class StatisticsCounters implements StatisticsHandler { for(CounterEventTypes cet : enabledCounters){ countersMap.get(cet).reset(); } - LOGGER.debug("StaticsCounters has been reset"); + LOG.debug("StaticsCounters has been reset"); } @Override @@ -241,8 +241,8 @@ public final class StatisticsCounters implements StatisticsHandler { @Override public void run() { for(CounterEventTypes cet : sc.getEnabledCounters()){ - LOG.debug(cet.name() + ": " + sc.getCountersMap().get(cet).getStat()); + LOG.debug("{}: {}", cet.name(), sc.getCountersMap().get(cet).getStat()); } } } -} \ No newline at end of file +}