2 * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.md.sal.dom.store.impl;
10 import java.util.concurrent.ExecutorService;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
13 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
14 import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
17 * A factory for creating InMemoryDOMDataStore instances.
19 * @author Thomas Pantelis
21 * @deprecated Use {@link org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStoreFactory} instead.
23 @Deprecated(forRemoval = true)
24 public final class InMemoryDOMDataStoreFactory {
26 private InMemoryDOMDataStoreFactory() {
29 public static InMemoryDOMDataStore create(final String name, final @Nullable DOMSchemaService schemaService) {
30 return create(name, schemaService, null);
34 * Creates an InMemoryDOMDataStore instance.
36 * @param name the name of the data store
37 * @param schemaService the SchemaService to which to register the data store.
38 * @param properties configuration properties for the InMemoryDOMDataStore instance. If null,
39 * default property values are used.
40 * @return an InMemoryDOMDataStore instance
42 public static InMemoryDOMDataStore create(final String name, final @Nullable DOMSchemaService schemaService,
43 final @Nullable InMemoryDOMDataStoreConfigProperties properties) {
44 return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, false, properties);
48 * Creates an InMemoryDOMDataStore instance.
50 * @param name the name of the data store
51 * @param type Data store type
52 * @param schemaService the SchemaService to which to register the data store.
53 * @param debugTransactions enable transaction debugging
54 * @param properties configuration properties for the InMemoryDOMDataStore instance. If null,
55 * default property values are used.
56 * @return an InMemoryDOMDataStore instance
58 public static InMemoryDOMDataStore create(final String name, final LogicalDatastoreType type,
59 final @Nullable DOMSchemaService schemaService, final boolean debugTransactions,
60 final @Nullable InMemoryDOMDataStoreConfigProperties properties) {
62 InMemoryDOMDataStoreConfigProperties actualProperties = properties;
63 if (actualProperties == null) {
64 actualProperties = InMemoryDOMDataStoreConfigProperties.getDefault();
67 // For DataChangeListener notifications we use an executor that provides the fastest
68 // task execution time to get higher throughput as DataChangeListeners typically provide
69 // much of the business logic for a data model. If the executor queue size limit is reached,
70 // subsequent submitted notifications will block the calling thread.
71 int dclExecutorMaxQueueSize = actualProperties.getMaxDataChangeExecutorQueueSize();
72 int dclExecutorMaxPoolSize = actualProperties.getMaxDataChangeExecutorPoolSize();
74 ExecutorService dataChangeListenerExecutor = SpecialExecutors.newBlockingBoundedFastThreadPool(
75 dclExecutorMaxPoolSize, dclExecutorMaxQueueSize, name + "-DCL", InMemoryDOMDataStore.class);
77 final InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, type, dataChangeListenerExecutor,
78 actualProperties.getMaxDataChangeListenerQueueSize(), debugTransactions);
80 if (schemaService != null) {
81 schemaService.registerSchemaContextListener(dataStore);