summaryrefslogtreecommitdiffstats
path: root/vnfapi/provider/src/main
diff options
context:
space:
mode:
authorJoey Sullivan <joey.sullivan@amdocs.com>2017-11-22 21:22:02 +0000
committerJoey Sullivan <joey.sullivan@amdocs.com>2017-11-22 21:37:44 +0000
commit69453d796578d46f1c0b98964b3a786718a86863 (patch)
tree3be3bf39287351978fdef2c54984aca9a8ee8cf5 /vnfapi/provider/src/main
parent1240ccff36e26154de009bb16a024e221566fb80 (diff)
Deleting missing vnf-list entry cause infiniteLoop
Deleting a vnf-list entry that does not exist from the databoker throws a ModifiedNodeDoesNotExistException. This conflicted with the optimistic locking retry mechanism causing a infinite loop. Change-Id: I216a31eabf710ed365c8d928e4df0e866848eeca Issue-ID: SDNC-156 Signed-off-by: Joey Sullivan <joey.sullivan@amdocs.com>
Diffstat (limited to 'vnfapi/provider/src/main')
-rw-r--r--vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
index e8a9e716..30f85859 100644
--- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
+++ b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
@@ -771,30 +771,33 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
InstanceIdentifier.<Vnfs>builder(Vnfs.class).child(VnfList.class, entry.getKey());
InstanceIdentifier<VnfList> path = vnfListIdBuilder.build();
- int tries = 2;
- while (true) {
+ int optimisticLockTries = 2;
+ boolean tryAgain =true;
+ while (tryAgain) {
+ tryAgain = false;
try {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.delete(storeType, path);
tx.submit().checkedGet();
log.debug("DataStore delete succeeded");
- break;
} catch (final TransactionCommitFailedException e) {
if (e instanceof OptimisticLockFailedException) {
- if (--tries <= 0) {
+ if (--optimisticLockTries <= 0) {
log.debug("Got OptimisticLockFailedException on last try - failing ");
throw new IllegalStateException(e);
}
log.debug("Got OptimisticLockFailedException - trying again ");
+ tryAgain = true;
+ continue;
}
- else {
- if (e.getCause() instanceof ModifiedNodeDoesNotExistException) {
- log.debug("Ignoring MpdifiedNodeDoesNotExistException");
- } else {
- log.debug("Delete DataStore failed");
- throw new IllegalStateException(e);
- }
+
+ if (e.getCause() instanceof ModifiedNodeDoesNotExistException) {
+ log.debug("Ignoring MpdifiedNodeDoesNotExistException");
+ break;
}
+
+ log.debug("Delete DataStore failed");
+ throw new IllegalStateException(e);
}
}
}