[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/device/impl/GossipDeviceStore.java b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
index acc8ff4..49c8534 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
@@ -257,6 +257,7 @@
@Deactivate
public void deactivate() {
+ devicePortStats.removeListener(portStatsListener);
devicePortStats.destroy();
devicePortDeltaStats.destroy();
executor.shutdownNow();
@@ -274,6 +275,24 @@
devices.clear();
devicePorts.clear();
availableDevices.clear();
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.DEVICE_UPDATE);
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.DEVICE_OFFLINE);
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.DEVICE_REMOVE_REQ);
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.DEVICE_REMOVED);
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.PORT_UPDATE);
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.PORT_STATUS_UPDATE);
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.DEVICE_ADVERTISE);
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.DEVICE_INJECTED);
+ clusterCommunicator.removeSubscriber(
+ GossipDeviceStoreMessageSubjects.PORT_INJECTED);
log.info("Stopped");
}