a7c8f11dfcd8d301f0806c9b087a4811b5774355
[policy/drools-applications.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP
4  * ================================================================================
5  * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.drools.apps.controlloop.feature.trans;
22
23 import java.util.List;
24 import java.util.UUID;
25 import org.onap.policy.controlloop.VirtualControlLoopNotification;
26 import org.onap.policy.drools.system.PolicyController;
27
28 /**
29  * Control Loop Metrics Tracker.
30  */
31 public interface ControlLoopMetrics {
32
33     /**
34      * Singleton manager object.
35      */
36     ControlLoopMetrics manager = new CacheBasedControlLoopMetricsManager();
37
38     /**
39      * Gets all transaction identifiers being monitored.
40      *
41      * @return transaction id list
42      */
43     List<UUID> getTransactionIds();
44
45     /**
46      * Gets all detailed transactions.
47      *
48      * @return list of transactions
49      */
50     List<VirtualControlLoopNotification> getTransactions();
51
52     /**
53      * Track controller's notification events.
54      *
55      * @param controller policy controller sending out notification
56      * @param notification notification
57      */
58     void transactionEvent(PolicyController controller, VirtualControlLoopNotification notification);
59
60     /**
61      * Gets an in-progress transaction.
62      *
63      * @param requestId request ID
64      * @return in progress notification
65      */
66     VirtualControlLoopNotification getTransaction(UUID requestId);
67
68     /**
69      * Removes an in-progress transaction.
70      *
71      * @param requestId request ID
72      */
73     void removeTransaction(UUID requestId);
74
75     /**
76      * Get cache size.
77      *
78      * @return cache size
79      */
80     long getCacheSize();
81
82     /**
83      * Get cache size.
84      *
85      * @return cache size
86      */
87     long getCacheOccupancy();
88
89     /**
90      * Sets cache size.
91      *
92      * @param cacheSize cache size
93      */
94     void setMaxCacheSize(long cacheSize);
95
96     /**
97      * Cached transaction expiration timeout in seconds.
98      *
99      * @return transaction timeout in seconds
100      */
101     long getTransactionTimeout();
102
103     /**
104      * Sets transaction timeout in seconds.
105      *
106      * @param transactionTimeout transaction timeout in seconds
107      */
108     void setTransactionTimeout(long transactionTimeout);
109
110     /**
111      * Reset cache.
112      *
113      * @param cacheSize new cache size
114      * @param transactionTimeout new transaction timeout in seconds
115      */
116     void resetCache(long cacheSize, long transactionTimeout);
117
118     /**
119      * Refresh underlying transaction management.
120      */
121     void refresh();
122 }