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;
37 private DistributionStatisticsManager() {
38 throw new IllegalStateException("Instantiation of the class is not allowed");
42 * Method to update the total distribution count.
44 * @return the updated value of totalDistributionCount
46 public static long updateTotalDistributionCount() {
47 return ++totalDistributionCount;
51 * Method to update the distribution success count.
53 * @return the updated value of distributionSuccessCount
55 public static long updateDistributionSuccessCount() {
56 return ++distributionSuccessCount;
60 * Method to update the distribution failure count.
62 * @return the updated value of distributionFailureCount
64 public static long updateDistributionFailureCount() {
65 return ++distributionFailureCount;
69 * Method to update the total download count.
71 * @return the updated value of totalDownloadCount
73 public static long updateTotalDownloadCount() {
74 return ++totalDownloadCount;
78 * Method to update the download success count.
80 * @return the updated value of downloadSuccessCount
82 public static long updateDownloadSuccessCount() {
83 return ++downloadSuccessCount;
87 * Method to update the download failure count.
89 * @return the updated value of downloadFailureCount
91 public static long updateDownloadFailureCount() {
92 return ++downloadFailureCount;
96 * Returns the current value of totalDistributionCount.
98 * @return the totalDistributionCount
100 public static long getTotalDistributionCount() {
101 return totalDistributionCount;
105 * Returns the current value of distributionSuccessCount.
107 * @return the distributionSuccessCount
109 public static long getDistributionSuccessCount() {
110 return distributionSuccessCount;
114 * Returns the current value of distributionFailureCount.
116 * @return the distributionFailureCount
118 public static long getDistributionFailureCount() {
119 return distributionFailureCount;
123 * Returns the current value of totalDownloadCount.
125 * @return the totalDownloadCount
127 public static long getTotalDownloadCount() {
128 return totalDownloadCount;
132 * Returns the current value of downloadSuccessCount.
134 * @return the downloadSuccessCount
136 public static long getDownloadSuccessCount() {
137 return downloadSuccessCount;
141 * Returns the current value of downloadFailureCount.
143 * @return the downloadFailureCount
145 public static long getDownloadFailureCount() {
146 return downloadFailureCount;
150 * Reset all the statistics counts to 0.
152 public static void resetAllStatistics() {
153 totalDistributionCount = 0L;
154 distributionSuccessCount = 0L;
155 distributionFailureCount = 0L;
156 totalDownloadCount = 0L;
157 downloadSuccessCount = 0L;
158 downloadFailureCount = 0L;