[ONOS-4789]some services don't remove listener in deactive function
Change-Id: I74c3f4eb14edcd93d06a8838a4205df381c7f678
diff --git a/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java b/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
index dc8ac58..29cd8e0 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
@@ -135,11 +135,12 @@
groupEntriesById = new ConcurrentHashMap<>();
private ConsistentMap<GroupStoreKeyMapKey,
StoredGroupEntry> auditPendingReqQueue = null;
+ private MapEventListener<GroupStoreKeyMapKey, StoredGroupEntry>
+ mapListener = new GroupStoreKeyMapListener();
private final ConcurrentMap<DeviceId, ConcurrentMap<GroupId, Group>>
extraneousGroupEntriesById = new ConcurrentHashMap<>();
private ExecutorService messageHandlingExecutor;
private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 1;
-
private final HashMap<DeviceId, Boolean> deviceAuditStatus = new HashMap<>();
private final AtomicInteger groupIdGen = new AtomicInteger();
@@ -198,7 +199,7 @@
.withName("onos-group-store-keymap")
.withSerializer(serializer)
.build();
- groupStoreEntriesByKey.addListener(new GroupStoreKeyMapListener());
+ groupStoreEntriesByKey.addListener(mapListener);
log.debug("Current size of groupstorekeymap:{}",
groupStoreEntriesByKey.size());
@@ -216,6 +217,7 @@
@Deactivate
public void deactivate() {
+ groupStoreEntriesByKey.removeListener(mapListener);
cfgService.unregisterProperties(getClass(), false);
clusterCommunicator.removeSubscriber(GroupStoreMessageSubjects.REMOTE_GROUP_OP_REQUEST);
log.info("Stopped");