aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common
diff options
context:
space:
mode:
authorRitu Sood <ritu.sood@intel.com>2017-09-27 03:19:57 -0700
committerRitu Sood <ritu.sood@intel.com>2017-09-27 03:23:27 -0700
commit19a6f09f4fd90ba4ede88165bd302acf907069ca (patch)
tree57af1f7026db608ac945945d7c6948ccffc95fa4 /controlloop/common
parent817bd6c46fabe57a9622cafcad88c9a3d087f8e3 (diff)
Add functionality for VFC request retries
This allows the control loop to track operation attempts in case of VFC failures. This will allow retries of the operation if required in the YAML file. Issue-ID: POLICY-270 Change-Id: Ieeaf6770a8d03fa4eecc976535301d9236d19972 Signed-off-by: Ritu Sood <ritu.sood@intel.com>
Diffstat (limited to 'controlloop/common')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index add981c65..e13352ac0 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -375,11 +375,12 @@ public class ControlLoopOperationManager implements Serializable {
} else if (response instanceof VFCResponse) {
VFCResponse vfcResponse = (VFCResponse) response;
+ Integer operationAttempt = this.attempts;
if (vfcResponse.responseDescriptor.getStatus().equalsIgnoreCase("finished")) {
//
// Consider it as success
//
- this.completeOperation(new Integer(1), " Success", PolicyResult.SUCCESS);
+ this.completeOperation(operationAttempt, " Success", PolicyResult.SUCCESS);
if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) {
return null;
}
@@ -388,10 +389,12 @@ public class ControlLoopOperationManager implements Serializable {
//
// Consider it as failure
//
- this.completeOperation(new Integer(1), " Failed", PolicyResult.FAILURE);
+ this.completeOperation(operationAttempt, " Failed", PolicyResult.FAILURE);
if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) {
return null;
}
+ // increment operation attempts for retries
+ this.attempts += 1;
return PolicyResult.FAILURE;
}
}