diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-04-06 11:50:50 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-04-06 11:50:50 +0200 |
commit | 23c6f72a9404ff116b1049f611f27ef3e7f462ae (patch) | |
tree | 7e118124f74aac2e74a7f917eb41967af19c7608 /src/main/java/org | |
parent | 46e851eb9dc2ba62f8be94c1b8ebf3a58fcaf860 (diff) |
Fix Sonar issues
Fix issues reported by Sonar on CldsService class
Issue-ID: CLAMP-147
Change-Id: I9eef9ccf4e69b19e2f63db1ef8634c29a84f3c56
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/service/CldsService.java | 11 |
1 files changed, 6 insertions, 5 deletions
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 2b6862dc5..cfea2535e 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -32,7 +32,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; import java.io.InputStream; import java.security.GeneralSecurityException; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Properties; @@ -121,6 +120,7 @@ public class CldsService extends SecureServiceBase { private SecureServicePermission permissionUpdateCl; private SecureServicePermission permissionReadTemplate; private SecureServicePermission permissionUpdateTemplate; + private static final long DCAE_DEPLOY_WAITING_TIME = TimeUnit.SECONDS.toNanos(30); @PostConstruct private final void afterConstruction() { @@ -161,8 +161,7 @@ public class CldsService extends SecureServiceBase { public List<CldsMonitoringDetails> getCLDSDetails() { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: GET model details", getPrincipalName()); - List<CldsMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CldsMonitoringDetails>(); - cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails(); + List<CldsMonitoringDetails> cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails(); // audit log LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Get cldsDetails success", this.getClass().getName()); @@ -831,12 +830,14 @@ public class CldsService extends SecureServiceBase { String createNewDeploymentStatusUrl = dcaeDispatcherServices.createNewDeployment(deploymentId, model.getTypeId(), modelProp.getGlobal().getDeployParameters()); String operationStatus = "processing"; - long waitingTime = System.nanoTime() + TimeUnit.MINUTES.toNanos(10); + long waitingTime = System.nanoTime() + DCAE_DEPLOY_WAITING_TIME; while ("processing".equalsIgnoreCase(operationStatus)) { - // Break the loop if waiting for more than 10 mins 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); } if ("succeeded".equalsIgnoreCase(operationStatus)) { |