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
9 package org.opendaylight.mdsal.dom.store.inmemory;
12 * Holds configuration properties when creating an {@link InMemoryDOMDataStore} instance via the
13 * {@link InMemoryDOMDataStoreFactory}.
15 * @author Thomas Pantelis
16 * @see InMemoryDOMDataStoreFactory
18 public final class InMemoryDOMDataStoreConfigProperties {
20 public static final int DEFAULT_MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE = 1000;
21 public static final int DEFAULT_MAX_DATA_CHANGE_EXECUTOR_POOL_SIZE = 20;
22 public static final int DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE = 1000;
23 public static final int DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE = 5000;
25 private static final InMemoryDOMDataStoreConfigProperties DEFAULT =
26 create(DEFAULT_MAX_DATA_CHANGE_EXECUTOR_POOL_SIZE,
27 DEFAULT_MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE,
28 DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE,
29 DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE);
31 private final int maxDataChangeExecutorQueueSize;
32 private final int maxDataChangeExecutorPoolSize;
33 private final int maxDataChangeListenerQueueSize;
34 private final int maxDataStoreExecutorQueueSize;
36 private InMemoryDOMDataStoreConfigProperties(final int maxDataChangeExecutorPoolSize,
37 final int maxDataChangeExecutorQueueSize, final int maxDataChangeListenerQueueSize,
38 final int maxDataStoreExecutorQueueSize) {
39 this.maxDataChangeExecutorQueueSize = maxDataChangeExecutorQueueSize;
40 this.maxDataChangeExecutorPoolSize = maxDataChangeExecutorPoolSize;
41 this.maxDataChangeListenerQueueSize = maxDataChangeListenerQueueSize;
42 this.maxDataStoreExecutorQueueSize = maxDataStoreExecutorQueueSize;
46 * Constructs an instance with the given property values.
48 * @param maxDataChangeExecutorPoolSize
49 * maximum thread pool size for the data change notification executor.
50 * @param maxDataChangeExecutorQueueSize
51 * maximum queue size for the data change notification executor.
52 * @param maxDataChangeListenerQueueSize
53 * maximum queue size for the data change listeners.
54 * @param maxDataStoreExecutorQueueSize
55 * maximum queue size for the data store executor.
57 public static InMemoryDOMDataStoreConfigProperties create(final int maxDataChangeExecutorPoolSize,
58 final int maxDataChangeExecutorQueueSize, final int maxDataChangeListenerQueueSize,
59 final int maxDataStoreExecutorQueueSize) {
60 return new InMemoryDOMDataStoreConfigProperties(maxDataChangeExecutorPoolSize,
61 maxDataChangeExecutorQueueSize, maxDataChangeListenerQueueSize,
62 maxDataStoreExecutorQueueSize);
65 public static InMemoryDOMDataStoreConfigProperties create(final int maxDataChangeExecutorPoolSize,
66 final int maxDataChangeExecutorQueueSize, final int maxDataChangeListenerQueueSize) {
67 return new InMemoryDOMDataStoreConfigProperties(maxDataChangeExecutorPoolSize,
68 maxDataChangeExecutorQueueSize, maxDataChangeListenerQueueSize,
69 DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE);
73 * Returns the InMemoryDOMDataStoreConfigProperties instance with default values.
75 public static InMemoryDOMDataStoreConfigProperties getDefault() {
80 * Returns the maximum queue size for the data change notification executor.
82 public int getMaxDataChangeExecutorQueueSize() {
83 return maxDataChangeExecutorQueueSize;
87 * Returns the maximum thread pool size for the data change notification executor.
89 public int getMaxDataChangeExecutorPoolSize() {
90 return maxDataChangeExecutorPoolSize;
94 * Returns the maximum queue size for the data change listeners.
96 public int getMaxDataChangeListenerQueueSize() {
97 return maxDataChangeListenerQueueSize;
101 * Returns the maximum queue size for the data store executor.
103 public int getMaxDataStoreExecutorQueueSize() {
104 return maxDataStoreExecutorQueueSize;