Rework InMemoryDOMDataStoreConfigProperties
[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 package org.opendaylight.mdsal.dom.store.inmemory;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.immutables.value.Value;
12 import org.immutables.value.Value.Style.ImplementationVisibility;
13
14 /**
15  * Holds configuration properties when creating an {@link InMemoryDOMDataStore} instance via the
16  * {@link InMemoryDOMDataStoreFactory}.
17  *
18  * @author Thomas Pantelis
19  * @see InMemoryDOMDataStoreFactory
20  */
21 @Value.Immutable
22 @Value.Style(visibility = ImplementationVisibility.PRIVATE)
23 public abstract class InMemoryDOMDataStoreConfigProperties {
24
25     public static final int DEFAULT_MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE = 1000;
26     public static final int DEFAULT_MAX_DATA_CHANGE_EXECUTOR_POOL_SIZE = 20;
27     public static final int DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE = 1000;
28     public static final int DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE = 5000;
29
30     private static final @NonNull InMemoryDOMDataStoreConfigProperties DEFAULT = builder().build();
31
32     /**
33      * Returns the InMemoryDOMDataStoreConfigProperties instance with default values.
34      *
35      * @return the InMemoryDOMDataStoreConfigProperties instance with default values.
36      */
37     public static @NonNull InMemoryDOMDataStoreConfigProperties getDefault() {
38         return DEFAULT;
39     }
40
41     /**
42      * Returns a new {@link InMemoryDOMDataStoreConfigPropertiesBuilder}.
43      *
44      * @return a new {@link InMemoryDOMDataStoreConfigPropertiesBuilder}.
45      */
46     public static @NonNull InMemoryDOMDataStoreConfigPropertiesBuilder builder() {
47         return new InMemoryDOMDataStoreConfigPropertiesBuilder();
48     }
49
50     /**
51      * Returns true if transaction allocation debugging should be enabled.
52      *
53      * @return true if transaction allocation debugging should be enabled.
54      */
55     @Value.Default
56     public boolean getDebugTransactions() {
57         return false;
58     }
59
60     /**
61      * Returns the maximum queue size for the data change notification executor.
62      *
63      * @return the maximum queue size for the data change notification executor.
64      */
65     @Value.Default
66     public int getMaxDataChangeExecutorQueueSize() {
67         return DEFAULT_MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE;
68     }
69
70     /**
71      * Returns the maximum thread pool size for the data change notification executor.
72      *
73      * @return the maximum thread pool size for the data change notification executor.
74      */
75     @Value.Default
76     public int getMaxDataChangeExecutorPoolSize() {
77         return DEFAULT_MAX_DATA_CHANGE_EXECUTOR_POOL_SIZE;
78     }
79
80     /**
81      * Returns the maximum queue size for the data change listeners.
82      */
83     @Value.Default
84     public int getMaxDataChangeListenerQueueSize() {
85         return DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE;
86     }
87
88     /**
89      * Returns the maximum queue size for the data store executor.
90      */
91     @Value.Default
92     public int getMaxDataStoreExecutorQueueSize() {
93         return DEFAULT_MAX_DATA_STORE_EXECUTOR_QUEUE_SIZE;
94     }
95 }