From c322f5b44ef208ebf8d72bf8e710b2d7881cac2f Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Thu, 12 Apr 2018 15:28:59 +0200 Subject: [PATCH] Fix sonar Fix sonar bugs reported in the new code Issue-ID: CLAMP-147 Change-Id: I77d686ddfd561f260aeb52f82085b73e3e1f1249 Signed-off-by: Determe, Sebastien (sd378r) --- .../org/onap/clamp/clds/sdc/controller/SdcSingleController.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java index a6296044..21deb649 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java @@ -200,10 +200,10 @@ public class SdcSingleController { public void treatNotification(INotificationData iNotif) { CsarHandler csar = null; try { - // wait for a random time, so that 2 running Clamp will not treat the same Notification at the same time - int i = ThreadLocalRandom.current().nextInt(1, 5); - Thread.sleep(i * 1000); - + // wait for a random time, so that 2 running Clamp will not treat + // the same Notification at the same time + long i = ThreadLocalRandom.current().nextInt(1, 5); + Thread.sleep(i * 1000L); logger.info("Notification received for service UUID:" + iNotif.getServiceUUID()); this.changeControllerStatus(SdcSingleControllerStatus.BUSY); csar = new CsarHandler(iNotif, this.sdcConfig.getSdcControllerName(), @@ -247,6 +247,7 @@ public class SdcSingleController { e.getMessage(), System.currentTimeMillis()); } catch (InterruptedException e) { logger.error("Interrupt exception caught during the notification processing", e); + Thread.currentThread().interrupt(); } catch (RuntimeException e) { logger.error("Unexpected exception caught during the notification processing", e); } finally { -- 2.16.6