summaryrefslogtreecommitdiffstats
path: root/cps-ri
diff options
context:
space:
mode:
authorToine Siebelink <toine.siebelink@est.tech>2022-06-03 08:11:25 +0000
committerGerrit Code Review <gerrit@onap.org>2022-06-03 08:11:25 +0000
commit5e80e3776bb47483ca71bcc3fbe2cd8c2b9389e3 (patch)
treed679255971d5fb9ced188ded5dd383ff5915e017 /cps-ri
parent002fb164cde7079cb3cac65a14b74fec9588ddc5 (diff)
parentcb1ceae605135ae054b70b335c2bd83205253539 (diff)
Merge "CPS-1020 : DuplicatedYangResourceException error at parallel cmHandle registration"
Diffstat (limited to 'cps-ri')
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
index 3719256fc..cbeb1b76f 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
@@ -66,6 +66,7 @@ import org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangModelDependencyIn
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
+import org.springframework.retry.support.RetrySynchronizationManager;
import org.springframework.stereotype.Component;
@Slf4j
@@ -219,9 +220,12 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ
convertToDuplicatedYangResourceException(
dataIntegrityViolationException, newYangResourceEntities);
convertedException.ifPresent(
- e -> log.warn(
- "Cannot persist duplicated yang resource. "
- + "System will attempt this method up to 5 times.", e));
+ e -> {
+ int retryCount = RetrySynchronizationManager.getContext() == null ? 0
+ : RetrySynchronizationManager.getContext().getRetryCount();
+ log.warn("Cannot persist duplicated yang resource. System will attempt this method "
+ + "up to 5 times. Current retry count : {}", ++retryCount, e);
+ });
throw convertedException.isPresent() ? convertedException.get() : dataIntegrityViolationException;
}
}