Fix DCAE deploy/undeploy
[clamp.git] / src / main / java / org / onap / clamp / clds / client / DcaeDispatcherServices.java
index 2ba910a..0ca2850 100644 (file)
@@ -90,6 +90,22 @@ public class DcaeDispatcherServices {
         }\r
     }\r
 \r
+    public String getOperationStatusWithRetry(String operationStatusUrl) throws InterruptedException {\r
+        String operationStatus = "";\r
+        for (int i = 0; i < Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.limit")); i++) {\r
+            logger.info("Trying to get Operation status on DCAE for url:" + operationStatusUrl);\r
+            operationStatus = getOperationStatus(operationStatusUrl);\r
+            logger.info("Current Status is:" + operationStatus);\r
+            if (!"processing".equalsIgnoreCase(operationStatus)) {\r
+                return operationStatus;\r
+            } else {\r
+                Thread.sleep(Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.interval")));\r
+            }\r
+        }\r
+        logger.warn("Number of attempts on DCAE is over, stopping the getOperationStatus method");\r
+        return operationStatus;\r
+    }\r
+\r
     /**\r
      * Get the Operation Status from a specified URL.\r
      * \r