diff options
author | Jim Hahn <jrh3@att.com> | 2020-05-04 20:13:11 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-05-04 20:19:11 -0400 |
commit | 26df07d10d9b0a7e6e9e9ab2d9cc14ed735c0d1d (patch) | |
tree | ad4887722c794b6e8b5b8b87ac894aaf60107803 /main/src/main/java/org/onap | |
parent | ed81ba9cc8e54c3c2d8c70972a6307a1b5bbe86a (diff) |
Eliminate spurious notifications from PAP
Tracked it down to the following sequence:
- policies were deployed to the pdp
- received a request to undeploy a policy
- generated a notification for the formerly deployed policy
- this should not have been generated
- undeployed the policy
- received a response from the pdp indicating the policy had
been undeployed
- generated a notification indicating the policy was undeployed
Removed the code that generated a notification when a policy is
initially moved from deployed to undeployed (or vice versa).
Issue-ID: POLICY-2539
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: If175974b5fa5ccda6a1e1ab8fa1326b263bb8005
Diffstat (limited to 'main/src/main/java/org/onap')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/notification/PolicyCommonTracker.java | 10 | ||||
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/notification/PolicyNotifier.java | 14 |
2 files changed, 6 insertions, 18 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/notification/PolicyCommonTracker.java b/main/src/main/java/org/onap/policy/pap/main/notification/PolicyCommonTracker.java index 67d9b988..5f702daf 100644 --- a/main/src/main/java/org/onap/policy/pap/main/notification/PolicyCommonTracker.java +++ b/main/src/main/java/org/onap/policy/pap/main/notification/PolicyCommonTracker.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP PAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -104,10 +104,8 @@ public abstract class PolicyCommonTracker { * Removes a set of PDPs from all policies within the tracker. * * @param notifyData data identifying the policy and the PDPs to be removed from it - * @param statusList status messages are added here if policies become complete as a - * result of this operation */ - public void removeData(PolicyPdpNotificationData notifyData, List<PolicyStatus> statusList) { + public void removeData(PolicyPdpNotificationData notifyData) { policy2data.computeIfPresent(notifyData.getPolicyId(), (policyId, data) -> { @@ -116,9 +114,7 @@ public abstract class PolicyCommonTracker { return data; } - // this policy is complete - notify - statusList.add(makeStatus(policyId, data)); - + // this policy is complete return (shouldRemove(data) ? null : data); }); } diff --git a/main/src/main/java/org/onap/policy/pap/main/notification/PolicyNotifier.java b/main/src/main/java/org/onap/policy/pap/main/notification/PolicyNotifier.java index c24cafca..430a09b9 100644 --- a/main/src/main/java/org/onap/policy/pap/main/notification/PolicyNotifier.java +++ b/main/src/main/java/org/onap/policy/pap/main/notification/PolicyNotifier.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP PAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -181,12 +181,8 @@ public class PolicyNotifier { * @param data data to be added */ public synchronized void addDeploymentData(PolicyPdpNotificationData data) { - PolicyNotification notification = new PolicyNotification(); - - undeployTracker.removeData(data, notification.getDeleted()); + undeployTracker.removeData(data); deployTracker.addData(data); - - publish(notification); } /** @@ -196,12 +192,8 @@ public class PolicyNotifier { * @param data data to be added */ public synchronized void addUndeploymentData(PolicyPdpNotificationData data) { - PolicyNotification notification = new PolicyNotification(); - - deployTracker.removeData(data, notification.getAdded()); + deployTracker.removeData(data); undeployTracker.addData(data); - - publish(notification); } /** |