[SDFAB-612] Cluster not ready when using recent tost master images
Initialize the local cache before adding the map listener
to prevent npe which are caused by events delivered during
the bootstrap process of the EC map
Change-Id: I823c12ccaa633a11a10d5b5d5fa7250a078ff4c5
diff --git a/core/store/dist/src/main/java/org/onosproject/store/meter/impl/DistributedMeterStore.java b/core/store/dist/src/main/java/org/onosproject/store/meter/impl/DistributedMeterStore.java
index b94375c..30da74d 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/meter/impl/DistributedMeterStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/meter/impl/DistributedMeterStore.java
@@ -114,7 +114,8 @@
// Meters id related objects
private static final String AVAILABLEMETERIDSTORE = "onos-meters-available-store";
- protected ConcurrentMap<MeterTableKey, DistributedSet<MeterKey>> availableMeterIds;
+ protected final ConcurrentMap<MeterTableKey, DistributedSet<MeterKey>> availableMeterIds =
+ new ConcurrentHashMap<>();
private static final String METERIDSTORE = "onos-meters-id-store";
private AtomicCounterMap<MeterTableKey> meterIdGenerators;
@@ -177,8 +178,6 @@
.withSerializer(APP_KRYO_BUILDER).build();
metersFeatures.addListener(featuresMapListener);
- availableMeterIds = new ConcurrentHashMap<>();
-
meterIdGenerators = storageService.<MeterTableKey>atomicCounterMapBuilder()
.withName(METERIDSTORE)
.withSerializer(Serializer.using(KryoNamespaces.API,