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%2FInMemoryDOMDataStoreFactory.java;h=f5c5c4ac7b8d4122825ca5058726d354cca1e710;hb=401577076374485afea34caeb33bce474563f752;hp=a3512743ed1a34acac5a1923983e06995e0d0f24;hpb=57769930716e9e5a55336145998525d3392c0ed8;p=controller.git diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreFactory.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreFactory.java index a3512743ed..f5c5c4ac7b 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreFactory.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreFactory.java @@ -5,17 +5,13 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.md.sal.dom.store.impl; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - import javax.annotation.Nullable; - -import org.opendaylight.controller.sal.core.api.model.SchemaService; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.yangtools.util.concurrent.SpecialExecutors; -import com.google.common.util.concurrent.MoreExecutors; /** * A factory for creating InMemoryDOMDataStore instances. @@ -28,7 +24,7 @@ public final class InMemoryDOMDataStoreFactory { } public static InMemoryDOMDataStore create(final String name, - @Nullable final SchemaService schemaService) { + @Nullable final DOMSchemaService schemaService) { return create(name, schemaService, null); } @@ -42,11 +38,28 @@ public final class InMemoryDOMDataStoreFactory { * @return an InMemoryDOMDataStore instance */ public static InMemoryDOMDataStore create(final String name, - @Nullable final SchemaService schemaService, + @Nullable final DOMSchemaService schemaService, + @Nullable final InMemoryDOMDataStoreConfigProperties properties) { + return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, false, properties); + } + + /** + * Creates an InMemoryDOMDataStore instance. + * + * @param name the name of the data store + * @param type Data store type + * @param schemaService the SchemaService to which to register the data store. + * @param debugTransactions enable transaction debugging + * @param properties configuration properties for the InMemoryDOMDataStore instance. If null, + * default property values are used. + * @return an InMemoryDOMDataStore instance + */ + public static InMemoryDOMDataStore create(final String name, final LogicalDatastoreType type, + @Nullable final DOMSchemaService schemaService, final boolean debugTransactions, @Nullable final InMemoryDOMDataStoreConfigProperties properties) { InMemoryDOMDataStoreConfigProperties actualProperties = properties; - if(actualProperties == null) { + if (actualProperties == null) { actualProperties = InMemoryDOMDataStoreConfigProperties.getDefault(); } @@ -54,18 +67,16 @@ public final class InMemoryDOMDataStoreFactory { // task execution time to get higher throughput as DataChangeListeners typically provide // much of the business logic for a data model. If the executor queue size limit is reached, // subsequent submitted notifications will block the calling thread. - int dclExecutorMaxQueueSize = actualProperties.getMaxDataChangeExecutorQueueSize(); int dclExecutorMaxPoolSize = actualProperties.getMaxDataChangeExecutorPoolSize(); ExecutorService dataChangeListenerExecutor = SpecialExecutors.newBlockingBoundedFastThreadPool( - dclExecutorMaxPoolSize, dclExecutorMaxQueueSize, name + "-DCL" ); + dclExecutorMaxPoolSize, dclExecutorMaxQueueSize, name + "-DCL", InMemoryDOMDataStore.class); - InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, - MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()), - dataChangeListenerExecutor, actualProperties.getMaxDataChangeListenerQueueSize()); + final InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, type, dataChangeListenerExecutor, + actualProperties.getMaxDataChangeListenerQueueSize(), debugTransactions); - if(schemaService != null) { + if (schemaService != null) { schemaService.registerSchemaContextListener(dataStore); }