X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-inmemory-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2FInMemoryDOMDataStore.java;h=354abcf69fe1040a1e24822b7db78aa6e674909d;hb=f0a3398f9a6598b9b7321ddf7d1a2f9433065d92;hp=b617a8087fc771d6f413b1ec6c3dc4e5bf597aa3;hpb=59e84273be97b1115fb3fb0f06364b7491a40385;p=controller.git diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java index b617a8087f..354abcf69f 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java @@ -205,8 +205,12 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype implements D } @Override - public ListenerRegistration registerTreeChangeListener(final YangInstanceIdentifier treeId, final L listener) { - return changePublisher.registerTreeChangeListener(treeId, listener); + public synchronized ListenerRegistration registerTreeChangeListener(final YangInstanceIdentifier treeId, final L listener) { + /* + * Make sure commit is not occurring right now. Listener has to be + * registered and its state capture enqueued at a consistent point. + */ + return changePublisher.registerTreeChangeListener(treeId, listener, dataTree.takeSnapshot()); } @Override @@ -224,7 +228,7 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype implements D return name + "-" + txCounter.getAndIncrement(); } - private static void warnDebugContext(AbstractDOMStoreTransaction transaction) { + private static void warnDebugContext(final AbstractDOMStoreTransaction transaction) { final Throwable ctx = transaction.getDebugContext(); if (ctx != null) { LOG.warn("Transaction {} has been allocated in the following context", transaction.getIdentifier(), ctx);