From: Robert Varga Date: Thu, 22 Sep 2016 18:21:31 +0000 (+0200) Subject: Convert to using BatchedListenerInvoker X-Git-Tag: release/boron-sr1~5 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=mdsal.git;a=commitdiff_plain;h=d07e90fde95e989da40376771b8e96abdffddfa8 Convert to using BatchedListenerInvoker This will deliver all notifications in one go, leading to faster flushing. Change-Id: I7a5023fadbfc67a19348963c15ae332986cd18d8 Signed-off-by: Robert Varga (cherry picked from commit f822ec2d88c315709ee845af39920a149b75b580) --- diff --git a/dom/mdsal-dom-inmemory-datastore/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDOMDataTreeShardChangePublisher.java b/dom/mdsal-dom-inmemory-datastore/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDOMDataTreeShardChangePublisher.java index df0223e587..690c5ae4dd 100644 --- a/dom/mdsal-dom-inmemory-datastore/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDOMDataTreeShardChangePublisher.java +++ b/dom/mdsal-dom-inmemory-datastore/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/InMemoryDOMDataTreeShardChangePublisher.java @@ -17,7 +17,7 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener; import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; import org.opendaylight.mdsal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration; import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager; -import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager.Invoker; +import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager.BatchedInvoker; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; @@ -30,11 +30,11 @@ final class InMemoryDOMDataTreeShardChangePublisher extends AbstractDOMShardTree private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMDataTreeShardChangePublisher.class); - private static final Invoker, DataTreeCandidate> - MANAGER_INVOKER = (listener, notification) -> { + private static final BatchedInvoker, DataTreeCandidate> + MANAGER_INVOKER = (listener, notifications) -> { final DOMDataTreeChangeListener inst = listener.getInstance(); if (inst != null) { - inst.onDataTreeChanged(ImmutableList.of(notification)); + inst.onDataTreeChanged(ImmutableList.copyOf(notifications)); } }; @@ -47,7 +47,7 @@ final class InMemoryDOMDataTreeShardChangePublisher extends AbstractDOMShardTree final YangInstanceIdentifier rootPath, final Map childShards) { super(dataTree, rootPath, childShards); - notificationManager = new QueuedNotificationManager<>( + notificationManager = QueuedNotificationManager.create( executor, MANAGER_INVOKER, maxQueueSize, "DataTreeChangeListenerQueueMgr"); }