X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2Ftree%2FListenerRegistrationNode.java;h=854c125af17a732f1d1c40365cb355ddae25a317;hb=accc07b1785811ed85038ac3c313c1d01724dc08;hp=2528d383b95a0c9f6534ad0f01627f56dbc26c5c;hpb=e27d63bdcfbfb0c1078a9c3e5aabf59ae7e2315f;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerRegistrationNode.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerRegistrationNode.java index 2528d383b9..854c125af1 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerRegistrationNode.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerRegistrationNode.java @@ -46,9 +46,16 @@ public class ListenerRegistrationNode implements StoreTreeNode> getListeners() { - // FIXME: this is not thread-safe and races with listener (un)registration! return (Collection) listeners; } @@ -67,7 +74,6 @@ public class ListenerRegistrationNode implements StoreTreeNode>> DataChangeListenerRegistration registerDataChangeListener(final InstanceIdentifier path, + public synchronized >> DataChangeListenerRegistration registerDataChangeListener(final InstanceIdentifier path, final L listener, final DataChangeScope scope) { DataChangeListenerRegistration listenerReg = new DataChangeListenerRegistration(path,listener, scope, this); listeners.add(listenerReg); + LOG.debug("Listener {} registered", listener); return listenerReg; } - private void removeListener(final DataChangeListenerRegistration listener) { + private synchronized void removeListener(final DataChangeListenerRegistration listener) { listeners.remove(listener); + LOG.debug("Listener {} unregistered", listener); removeThisIfUnused(); }