X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-inmemory-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2FInMemoryDOMStoreTreeChangePublisher.java;fp=opendaylight%2Fmd-sal%2Fsal-inmemory-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2FInMemoryDOMStoreTreeChangePublisher.java;h=22e4c4d8a3dfc2656bb8d2b395e41176f93d900c;hp=342dc0c35b370856ae3efff5254a4a8ad343ebb9;hb=0f7afdeb0b33a9f1fa3a5085c536e6c3b6aba862;hpb=f8b768f558e8f77509f1e37de6da382f821c8be0 diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreTreeChangePublisher.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreTreeChangePublisher.java index 342dc0c35b..22e4c4d8a3 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreTreeChangePublisher.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreTreeChangePublisher.java @@ -43,6 +43,11 @@ final class InMemoryDOMStoreTreeChangePublisher extends AbstractDOMStoreTreeChan notificationManager = new QueuedNotificationManager<>(listenerExecutor, MANAGER_INVOKER, maxQueueSize, "DataTreeChangeListenerQueueMgr"); } + private InMemoryDOMStoreTreeChangePublisher(QueuedNotificationManager< + AbstractDOMDataTreeChangeListenerRegistration, DataTreeCandidate> notificationManager) { + this.notificationManager = notificationManager; + } + @Override protected void notifyListeners(final Collection> registrations, final YangInstanceIdentifier path, final DataTreeCandidateNode node) { final DataTreeCandidate candidate = DataTreeCandidates.newDataTreeCandidate(path, node); @@ -63,10 +68,15 @@ final class InMemoryDOMStoreTreeChangePublisher extends AbstractDOMStoreTreeChan ListenerRegistration registerTreeChangeListener(final YangInstanceIdentifier treeId, final L listener, final DataTreeSnapshot snapshot) { final AbstractDOMDataTreeChangeListenerRegistration reg = registerTreeChangeListener(treeId, listener); - final Optional> node = snapshot.readNode(treeId); + final Optional> node = snapshot.readNode(YangInstanceIdentifier.EMPTY); if (node.isPresent()) { - final DataTreeCandidate candidate = DataTreeCandidates.fromNormalizedNode(treeId, node.get()); - notificationManager.submitNotification(reg, candidate); + final DataTreeCandidate candidate = DataTreeCandidates.fromNormalizedNode( + YangInstanceIdentifier.EMPTY, node.get()); + + InMemoryDOMStoreTreeChangePublisher publisher = + new InMemoryDOMStoreTreeChangePublisher(notificationManager); + publisher.registerTreeChangeListener(treeId, listener); + publisher.publishChange(candidate); } return reg;