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=aad39987fa9d5bb244319584ce27978d3cda7294;hb=c5f3be93482d6b06d95ebf22b2ef2723fd813f89;hp=2ee8e182c255fef59d8b219fa565473e2e8f362a;hpb=510f3bd2d25c0e667a60ff5ef18cfbd40534cec0;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 2ee8e182c2..aad39987fa 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 @@ -7,11 +7,11 @@ */ package org.opendaylight.controller.md.sal.dom.store.impl; -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; import java.util.concurrent.ExecutorService; import javax.annotation.Nullable; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.sal.core.api.model.SchemaService; +import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.yangtools.util.concurrent.SpecialExecutors; /** @@ -24,8 +24,19 @@ public final class InMemoryDOMDataStoreFactory { private InMemoryDOMDataStoreFactory() { } + /** + * Deprecated. + * + * @deprecated Use {@link #create(String, DOMSchemaService)} instead. + */ + @Deprecated public static InMemoryDOMDataStore create(final String name, @Nullable final SchemaService schemaService) { + return create(name, (DOMSchemaService)schemaService); + } + + public static InMemoryDOMDataStore create(final String name, + @Nullable final DOMSchemaService schemaService) { return create(name, schemaService, null); } @@ -37,11 +48,29 @@ public final class InMemoryDOMDataStoreFactory { * @param properties configuration properties for the InMemoryDOMDataStore instance. If null, * default property values are used. * @return an InMemoryDOMDataStore instance + * + * @deprecated Use {@link #create(String, DOMSchemaService, InMemoryDOMDataStoreConfigProperties)} instead. */ + @Deprecated public static InMemoryDOMDataStore create(final String name, @Nullable final SchemaService schemaService, @Nullable final InMemoryDOMDataStoreConfigProperties properties) { - return create(name, schemaService, false, properties); + return create(name, (DOMSchemaService) schemaService, properties); + } + + /** + * 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 DOMSchemaService schemaService, + @Nullable final InMemoryDOMDataStoreConfigProperties properties) { + return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, false, properties); } /** @@ -53,10 +82,52 @@ public final class InMemoryDOMDataStoreFactory { * @param properties configuration properties for the InMemoryDOMDataStore instance. If null, * default property values are used. * @return an InMemoryDOMDataStore instance + * + * @deprecated Use {@link #create(String, LogicalDatastoreType, SchemaService, boolean, + * InMemoryDOMDataStoreConfigProperties)} instead. */ + @Deprecated public static InMemoryDOMDataStore create(final String name, @Nullable final SchemaService schemaService, final boolean debugTransactions, @Nullable final InMemoryDOMDataStoreConfigProperties properties) { + return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, debugTransactions, 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 + * + * @deprecated Use {@link #create(String, LogicalDatastoreType, DOMSchemaService, boolean, + * InMemoryDOMDataStoreConfigProperties)} instead. + */ + @Deprecated + public static InMemoryDOMDataStore create(final String name, final LogicalDatastoreType type, + @Nullable final SchemaService schemaService, final boolean debugTransactions, + @Nullable final InMemoryDOMDataStoreConfigProperties properties) { + return create(name, type, (DOMSchemaService) schemaService, debugTransactions, 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) { @@ -71,11 +142,9 @@ public final class InMemoryDOMDataStoreFactory { int dclExecutorMaxPoolSize = actualProperties.getMaxDataChangeExecutorPoolSize(); ExecutorService dataChangeListenerExecutor = SpecialExecutors.newBlockingBoundedFastThreadPool( - dclExecutorMaxPoolSize, dclExecutorMaxQueueSize, name + "-DCL" ); + dclExecutorMaxPoolSize, dclExecutorMaxQueueSize, name + "-DCL", InMemoryDOMDataStore.class); - final ListeningExecutorService commitExecutor = MoreExecutors.sameThreadExecutor(); - final InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, - commitExecutor, dataChangeListenerExecutor, + final InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, type, dataChangeListenerExecutor, actualProperties.getMaxDataChangeListenerQueueSize(), debugTransactions); if (schemaService != null) {