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.controller.md.sal.dom.store.impl;
12 * Holds configuration properties when creating an {@link InMemoryDOMDataStore} instance via the
13 * {@link InMemoryDOMDataStoreFactory}
15 * @author Thomas Pantelis
16 * @see InMemoryDOMDataStoreFactory
18 public 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;
37 * Constructs an instance with the given property values.
39 * @param maxDataChangeExecutorPoolSize
40 * maximum thread pool size for the data change notification executor.
41 * @param maxDataChangeExecutorQueueSize
42 * maximum queue size for the data change notification executor.
43 * @param maxDataChangeListenerQueueSize
44 * maximum queue size for the data change listeners.
45 * @param maxDataStoreExecutorQueueSize
46 * maximum queue size for the data store executor.
48 public static InMemoryDOMDataStoreConfigProperties create(int maxDataChangeExecutorPoolSize,
49 int maxDataChangeExecutorQueueSize, int maxDataChangeListenerQueueSize,
50 int maxDataStoreExecutorQueueSize) {
51 return new InMemoryDOMDataStoreConfigProperties(maxDataChangeExecutorPoolSize,
52 maxDataChangeExecutorQueueSize, maxDataChangeListenerQueueSize,
53 maxDataStoreExecutorQueueSize);
56 public static InMemoryDOMDataStoreConfigProperties create(int maxDataChangeExecutorPoolSize,
57 int maxDataChangeExecutorQueueSize, int maxDataChangeListenerQueueSize) {
58 return new InMemoryDOMDataStoreConfigProperties(maxDataChangeExecutorPoolSize,
59 maxDataChangeExecutorQueueSize, maxDataChangeListenerQueueSize,
60 DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE);
64 * Returns the InMemoryDOMDataStoreConfigProperties instance with default values.
66 public static InMemoryDOMDataStoreConfigProperties getDefault() {
70 private InMemoryDOMDataStoreConfigProperties(int maxDataChangeExecutorPoolSize,
71 int maxDataChangeExecutorQueueSize, int maxDataChangeListenerQueueSize,
72 int maxDataStoreExecutorQueueSize) {
73 this.maxDataChangeExecutorQueueSize = maxDataChangeExecutorQueueSize;
74 this.maxDataChangeExecutorPoolSize = maxDataChangeExecutorPoolSize;
75 this.maxDataChangeListenerQueueSize = maxDataChangeListenerQueueSize;
76 this.maxDataStoreExecutorQueueSize = maxDataStoreExecutorQueueSize;
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;