aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java16
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java21
2 files changed, 18 insertions, 19 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
index 2ba910a6e..0ca2850f3 100644
--- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java
@@ -90,6 +90,22 @@ public class DcaeDispatcherServices {
}
}
+ public String getOperationStatusWithRetry(String operationStatusUrl) throws InterruptedException {
+ String operationStatus = "";
+ for (int i = 0; i < Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.limit")); i++) {
+ logger.info("Trying to get Operation status on DCAE for url:" + operationStatusUrl);
+ operationStatus = getOperationStatus(operationStatusUrl);
+ logger.info("Current Status is:" + operationStatus);
+ if (!"processing".equalsIgnoreCase(operationStatus)) {
+ return operationStatus;
+ } else {
+ Thread.sleep(Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.interval")));
+ }
+ }
+ logger.warn("Number of attempts on DCAE is over, stopping the getOperationStatus method");
+ return operationStatus;
+ }
+
/**
* Get the Operation Status from a specified URL.
*
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index 1b7606705..592a94575 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -849,17 +849,7 @@ public class CldsService extends SecureServiceBase {
}
String createNewDeploymentStatusUrl = dcaeDispatcherServices.createNewDeployment(deploymentId,
model.getTypeId(), modelProp.getGlobal().getDeployParameters());
- String operationStatus = "processing";
- long waitingTime = System.nanoTime() + DCAE_DEPLOY_WAITING_TIME;
- while ("processing".equalsIgnoreCase(operationStatus)) {
- if (waitingTime < System.nanoTime()) {
- logger.info("Waiting is over for DCAE deployment");
- break;
- }
- logger.info("Waiting 5s before sending query to DCAE");
- Thread.sleep(5000);
- operationStatus = dcaeDispatcherServices.getOperationStatus(createNewDeploymentStatusUrl);
- }
+ String operationStatus = dcaeDispatcherServices.getOperationStatusWithRetry(createNewDeploymentStatusUrl);
if ("succeeded".equalsIgnoreCase(operationStatus)) {
String artifactName = model.getControlName();
if (artifactName != null) {
@@ -904,14 +894,7 @@ public class CldsService extends SecureServiceBase {
try {
String operationStatusUndeployUrl = dcaeDispatcherServices.deleteExistingDeployment(model.getDeploymentId(),
model.getTypeId());
- String operationStatus = "processing";
- long waitingTime = System.nanoTime() + TimeUnit.MINUTES.toNanos(10);
- while ("processing".equalsIgnoreCase(operationStatus)) {
- if (waitingTime < System.nanoTime()) {
- break;
- }
- operationStatus = dcaeDispatcherServices.getOperationStatus(operationStatusUndeployUrl);
- }
+ String operationStatus = dcaeDispatcherServices.getOperationStatusWithRetry(operationStatusUndeployUrl);
if ("succeeded".equalsIgnoreCase(operationStatus)) {
String artifactName = model.getControlName();
if (artifactName != null) {