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=a3512743ed1a34acac5a1923983e06995e0d0f24;hb=7150c9b7bba2a23794f6beed20008c747c53ab60;hp=c853a132de6395fb1b562406e0edfcddeeed1166;hpb=24c8edfec01c5a61bf40a930aec018502cd37275;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 c853a132de..a3512743ed 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 @@ -15,7 +15,6 @@ import javax.annotation.Nullable; import org.opendaylight.controller.sal.core.api.model.SchemaService; import org.opendaylight.yangtools.util.concurrent.SpecialExecutors; -import org.opendaylight.yangtools.util.PropertyUtils; import com.google.common.util.concurrent.MoreExecutors; /** @@ -25,43 +24,46 @@ import com.google.common.util.concurrent.MoreExecutors; */ public final class InMemoryDOMDataStoreFactory { - private static final String DCL_EXECUTOR_MAX_QUEUE_SIZE_PROP = - "mdsal.datastore-dcl-notification-queue.size"; - private static final int DEFAULT_DCL_EXECUTOR_MAX_QUEUE_SIZE = 1000; - - private static final String DCL_EXECUTOR_MAX_POOL_SIZE_PROP = - "mdsal.datastore-dcl-notification-pool.size"; - private static final int DEFAULT_DCL_EXECUTOR_MAX_POOL_SIZE = 20; - private InMemoryDOMDataStoreFactory() { } + public static InMemoryDOMDataStore create(final String name, + @Nullable final SchemaService schemaService) { + return create(name, schemaService, null); + } + /** * Creates an InMemoryDOMDataStore instance. * * @param name the name of the data store * @param schemaService the SchemaService to which to register the data store. + * @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, - @Nullable final SchemaService schemaService) { + @Nullable final SchemaService schemaService, + @Nullable final InMemoryDOMDataStoreConfigProperties properties) { + + InMemoryDOMDataStoreConfigProperties actualProperties = properties; + if(actualProperties == null) { + actualProperties = InMemoryDOMDataStoreConfigProperties.getDefault(); + } // For DataChangeListener notifications we use an executor that provides the fastest // 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 = PropertyUtils.getIntSystemProperty( - DCL_EXECUTOR_MAX_QUEUE_SIZE_PROP, DEFAULT_DCL_EXECUTOR_MAX_QUEUE_SIZE); - int dclExecutorMaxPoolSize = PropertyUtils.getIntSystemProperty( - DCL_EXECUTOR_MAX_POOL_SIZE_PROP, DEFAULT_DCL_EXECUTOR_MAX_POOL_SIZE); + int dclExecutorMaxQueueSize = actualProperties.getMaxDataChangeExecutorQueueSize(); + int dclExecutorMaxPoolSize = actualProperties.getMaxDataChangeExecutorPoolSize(); ExecutorService dataChangeListenerExecutor = SpecialExecutors.newBlockingBoundedFastThreadPool( dclExecutorMaxPoolSize, dclExecutorMaxQueueSize, name + "-DCL" ); InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()), - dataChangeListenerExecutor); + dataChangeListenerExecutor, actualProperties.getMaxDataChangeListenerQueueSize()); if(schemaService != null) { schemaService.registerSchemaContextListener(dataStore);