2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.distribution.reception.statistics;
24 * Class to hold statistical data for distribution component.
26 * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
28 public class DistributionStatisticsManager {
30 private static long totalDistributionCount;
31 private static long distributionSuccessCount;
32 private static long distributionFailureCount;
33 private static long totalDownloadCount;
34 private static long downloadSuccessCount;
35 private static long downloadFailureCount;
38 * Method to update the total distribution count.
40 * @return the updated value of totalDistributionCount
42 public static long updateTotalDistributionCount() {
43 return ++totalDistributionCount;
47 * Method to update the distribution success count.
49 * @return the updated value of distributionSuccessCount
51 public static long updateDistributionSuccessCount() {
52 return ++distributionSuccessCount;
56 * Method to update the distribution failure count.
58 * @return the updated value of distributionFailureCount
60 public static long updateDistributionFailureCount() {
61 return ++distributionFailureCount;
65 * Method to update the total download count.
67 * @return the updated value of totalDownloadCount
69 public static long updateTotalDownloadCount() {
70 return ++totalDownloadCount;
74 * Method to update the download success count.
76 * @return the updated value of downloadSuccessCount
78 public static long updateDownloadSuccessCount() {
79 return ++downloadSuccessCount;
83 * Method to update the download failure count.
85 * @return the updated value of downloadFailureCount
87 public static long updateDownloadFailureCount() {
88 return ++downloadFailureCount;
92 * Returns the current value of totalDistributionCount.
94 * @return the totalDistributionCount
96 public static long getTotalDistributionCount() {
97 return totalDistributionCount;
101 * Returns the current value of distributionSuccessCount.
103 * @return the distributionSuccessCount
105 public static long getDistributionSuccessCount() {
106 return distributionSuccessCount;
110 * Returns the current value of distributionFailureCount.
112 * @return the distributionFailureCount
114 public static long getDistributionFailureCount() {
115 return distributionFailureCount;
119 * Returns the current value of totalDownloadCount.
121 * @return the totalDownloadCount
123 public static long getTotalDownloadCount() {
124 return totalDownloadCount;
128 * Returns the current value of downloadSuccessCount.
130 * @return the downloadSuccessCount
132 public static long getDownloadSuccessCount() {
133 return downloadSuccessCount;
137 * Returns the current value of downloadFailureCount.
139 * @return the downloadFailureCount
141 public static long getDownloadFailureCount() {
142 return downloadFailureCount;
146 * Reset all the statistics counts to 0.
148 public static void resetAllStatistics() {
149 totalDistributionCount = 0L;
150 distributionSuccessCount = 0L;
151 distributionFailureCount = 0L;
152 totalDownloadCount = 0L;
153 downloadSuccessCount = 0L;
154 downloadFailureCount = 0L;