+ <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
+ final YangInstanceIdentifier treeId, final L listener, final DataTreeSnapshot snapshot) {
+ final AbstractDOMDataTreeChangeListenerRegistration<L> reg = registerTreeChangeListener(treeId, listener);
+
+ final Optional<NormalizedNode<?, ?>> node = snapshot.readNode(YangInstanceIdentifier.empty());
+ if (node.isPresent()) {
+ final DataTreeCandidate candidate = DataTreeCandidates.fromNormalizedNode(
+ YangInstanceIdentifier.empty(), node.get());
+
+ InMemoryDOMStoreTreeChangePublisher publisher =
+ new InMemoryDOMStoreTreeChangePublisher(notificationManager);
+ publisher.registerTreeChangeListener(treeId, listener);
+ publisher.publishChange(candidate);
+ }
+
+ return reg;
+ }
+
+ synchronized void publishChange(final @NonNull DataTreeCandidate candidate) {