BUG-5032: BGP Operational State
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / stats / peer / route / PerTableTypeRouteCounter.java
index e2af7a3378210916070994ab7945007caca28e61..57bc5f82ade7e3af300ccc9c1bf4eb2f66a3ea90 100644 (file)
@@ -47,6 +47,7 @@ public final class PerTableTypeRouteCounter {
     /**
      * Get the counter for given tablesKey. Return an empty counter if it doesn't exist
      * NOTE: the created empty counter won't be put into the original map
+     *
      * @param tablesKey
      * @return
      */
@@ -57,6 +58,7 @@ public final class PerTableTypeRouteCounter {
     /**
      * Get the counter with given tablesKey.  Create an empty counter if it doesn't exist
      * This method will put the created empty counter back to map
+     *
      * @param tablesKey
      * @return
      */
@@ -76,4 +78,10 @@ public final class PerTableTypeRouteCounter {
         LOG.debug("Resetting all route counters..");
         this.counters.values().forEach(LongAdder::reset);
     }
+
+    public void setValueToCounterOrSetDefault(final TablesKey tablesKey, final int size) {
+        final LongAdder counter = getCounterOrSetDefault(tablesKey);
+        counter.reset();
+        counter.add(size);
+    }
 }