Hz: remove listeners on deactivate
Change-Id: I544917508cd4b9513e3fcd3a100c44928954f413
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/core/impl/DistributedApplicationIdStore.java b/core/store/dist/src/main/java/org/onlab/onos/store/core/impl/DistributedApplicationIdStore.java
index 884bc12..4c3aa7a 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/core/impl/DistributedApplicationIdStore.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/core/impl/DistributedApplicationIdStore.java
@@ -22,6 +22,7 @@
import com.hazelcast.core.EntryListener;
import com.hazelcast.core.IAtomicLong;
import com.hazelcast.core.MapEvent;
+
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -54,6 +55,8 @@
protected Map<Short, DefaultApplicationId> appIds = new ConcurrentHashMap<>();
+ private String listenerId;
+
@Override
@Activate
@@ -73,7 +76,7 @@
lastAppId = theInstance.getAtomicLong("applicationId");
appIdsByName = new SMap<>(theInstance.<byte[], byte[]>getMap("appIdsByName"), this.serializer);
- appIdsByName.addEntryListener((new RemoteAppIdEventHandler()), true);
+ listenerId = appIdsByName.addEntryListener((new RemoteAppIdEventHandler()), true);
primeAppIds();
@@ -82,6 +85,7 @@
@Deactivate
public void deactivate() {
+ appIdsByName.removeEntryListener(listenerId);
log.info("Stopped");
}