Fix odlparent-3.0.0 checkstyle issues
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / InMemoryDOMDataStoreConfigProperties.java
1 /*
2  * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.mdsal.dom.store.inmemory;
10
11 /**
12  * Holds configuration properties when creating an {@link InMemoryDOMDataStore} instance via the
13  * {@link InMemoryDOMDataStoreFactory}.
14  *
15  * @author Thomas Pantelis
16  * @see InMemoryDOMDataStoreFactory
17  */
18 public final class InMemoryDOMDataStoreConfigProperties {
19
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;
24
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);
30
31     private final int maxDataChangeExecutorQueueSize;
32     private final int maxDataChangeExecutorPoolSize;
33     private final int maxDataChangeListenerQueueSize;
34     private final int maxDataStoreExecutorQueueSize;
35
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;
43     }
44
45     /**
46      * Constructs an instance with the given property values.
47      *
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.
56      */
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);
63     }
64
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);
70     }
71
72     /**
73      * Returns the InMemoryDOMDataStoreConfigProperties instance with default values.
74      */
75     public static InMemoryDOMDataStoreConfigProperties getDefault() {
76         return DEFAULT;
77     }
78
79     /**
80      * Returns the maximum queue size for the data change notification executor.
81      */
82     public int getMaxDataChangeExecutorQueueSize() {
83         return maxDataChangeExecutorQueueSize;
84     }
85
86     /**
87      * Returns the maximum thread pool size for the data change notification executor.
88      */
89     public int getMaxDataChangeExecutorPoolSize() {
90         return maxDataChangeExecutorPoolSize;
91     }
92
93     /**
94      * Returns the maximum queue size for the data change listeners.
95      */
96     public int getMaxDataChangeListenerQueueSize() {
97         return maxDataChangeListenerQueueSize;
98     }
99
100     /**
101      * Returns the maximum queue size for the data store executor.
102      */
103     public int getMaxDataStoreExecutorQueueSize() {
104         return maxDataStoreExecutorQueueSize;
105     }
106 }