Fix checkstyle violations in sal-inmemory-datastore
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / main / java / org / opendaylight / controller / md / sal / dom / store / impl / 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.controller.md.sal.dom.store.impl;
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     /**
37      * Constructs an instance with the given property values.
38      *
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.
47      */
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);
54     }
55
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);
61     }
62
63     /**
64      * Returns the InMemoryDOMDataStoreConfigProperties instance with default values.
65      */
66     public static InMemoryDOMDataStoreConfigProperties getDefault() {
67         return DEFAULT;
68     }
69
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;
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 }