From cd1d0fb2229af043c36f8225d6e5d8a8e8fe78dd Mon Sep 17 00:00:00 2001 From: jhh Date: Tue, 16 Feb 2021 18:09:46 -0600 Subject: deploy stats in lifecycle module Issue-ID: POLICY-3033 Signed-off-by: jhh Change-Id: Iaa78aa48064e8288265aeb498279e9d8324538d8 Signed-off-by: jhh --- .../src/main/java/org/onap/policy/drools/stats/PolicyStats.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'policy-management/src/main') diff --git a/policy-management/src/main/java/org/onap/policy/drools/stats/PolicyStats.java b/policy-management/src/main/java/org/onap/policy/drools/stats/PolicyStats.java index d6d8d500..add4c18c 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/stats/PolicyStats.java +++ b/policy-management/src/main/java/org/onap/policy/drools/stats/PolicyStats.java @@ -23,10 +23,12 @@ package org.onap.policy.drools.stats; import static org.slf4j.LoggerFactory.getLogger; import java.time.Instant; -import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; +import lombok.Setter; +import lombok.Synchronized; import lombok.ToString; import org.onap.policy.drools.metrics.TransMetric; import org.slf4j.Logger; @@ -35,7 +37,8 @@ import org.slf4j.Logger; * Basic policy execution statistics. */ -@Data +@Setter(onMethod_ = @Synchronized) +@Getter(onMethod_ = @Synchronized) @NoArgsConstructor @EqualsAndHashCode @ToString @@ -86,6 +89,8 @@ public class PolicyStats { /** * add a stat transaction record. */ + + @Synchronized public void stat(@NonNull TransMetric trans) { policyExecutedCount++; if (trans.isSuccess()) { -- cgit 1.2.3-korg