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 javax.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.
24 public final class InMemoryDOMDataStoreFactory {
26 private InMemoryDOMDataStoreFactory() {
29 public static InMemoryDOMDataStore create(final String name,
30 @Nullable final DOMSchemaService schemaService) {
31 return create(name, schemaService, null);
35 * Creates an InMemoryDOMDataStore instance.
37 * @param name the name of the data store
38 * @param schemaService the SchemaService to which to register the data store.
39 * @param properties configuration properties for the InMemoryDOMDataStore instance. If null,
40 * default property values are used.
41 * @return an InMemoryDOMDataStore instance
43 public static InMemoryDOMDataStore create(final String name,
44 @Nullable final DOMSchemaService schemaService,
45 @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
46 return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, false, properties);
50 * Creates an InMemoryDOMDataStore instance.
52 * @param name the name of the data store
53 * @param type Data store type
54 * @param schemaService the SchemaService to which to register the data store.
55 * @param debugTransactions enable transaction debugging
56 * @param properties configuration properties for the InMemoryDOMDataStore instance. If null,
57 * default property values are used.
58 * @return an InMemoryDOMDataStore instance
60 public static InMemoryDOMDataStore create(final String name, final LogicalDatastoreType type,
61 @Nullable final DOMSchemaService schemaService, final boolean debugTransactions,
62 @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
64 InMemoryDOMDataStoreConfigProperties actualProperties = properties;
65 if (actualProperties == null) {
66 actualProperties = InMemoryDOMDataStoreConfigProperties.getDefault();
69 // For DataChangeListener notifications we use an executor that provides the fastest
70 // task execution time to get higher throughput as DataChangeListeners typically provide
71 // much of the business logic for a data model. If the executor queue size limit is reached,
72 // subsequent submitted notifications will block the calling thread.
73 int dclExecutorMaxQueueSize = actualProperties.getMaxDataChangeExecutorQueueSize();
74 int dclExecutorMaxPoolSize = actualProperties.getMaxDataChangeExecutorPoolSize();
76 ExecutorService dataChangeListenerExecutor = SpecialExecutors.newBlockingBoundedFastThreadPool(
77 dclExecutorMaxPoolSize, dclExecutorMaxQueueSize, name + "-DCL", InMemoryDOMDataStore.class);
79 final InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name, type, dataChangeListenerExecutor,
80 actualProperties.getMaxDataChangeListenerQueueSize(), debugTransactions);
82 if (schemaService != null) {
83 schemaService.registerSchemaContextListener(dataStore);