Fix sonar 01/42501/1
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Thu, 12 Apr 2018 13:28:59 +0000 (15:28 +0200)
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Thu, 12 Apr 2018 13:28:59 +0000 (15:28 +0200)
Fix sonar bugs reported in the new code

Issue-ID: CLAMP-147
Change-Id: I77d686ddfd561f260aeb52f82085b73e3e1f1249
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java

index a629604..21deb64 100644 (file)
@@ -200,10 +200,10 @@ public class SdcSingleController {
     public void treatNotification(INotificationData iNotif) {\r
         CsarHandler csar = null;\r
         try {\r
-            // wait for a random time, so that 2 running Clamp will not treat the same Notification at the same time \r
-            int i = ThreadLocalRandom.current().nextInt(1, 5);\r
-            Thread.sleep(i * 1000);\r
-\r
+            // wait for a random time, so that 2 running Clamp will not treat\r
+            // the same Notification at the same time\r
+            long i = ThreadLocalRandom.current().nextInt(1, 5);\r
+            Thread.sleep(i * 1000L);\r
             logger.info("Notification received for service UUID:" + iNotif.getServiceUUID());\r
             this.changeControllerStatus(SdcSingleControllerStatus.BUSY);\r
             csar = new CsarHandler(iNotif, this.sdcConfig.getSdcControllerName(),\r
@@ -247,6 +247,7 @@ public class SdcSingleController {
                     e.getMessage(), System.currentTimeMillis());\r
         } catch (InterruptedException e) {\r
             logger.error("Interrupt exception caught during the notification processing", e);\r
+            Thread.currentThread().interrupt();\r
         } catch (RuntimeException e) {\r
             logger.error("Unexpected exception caught during the notification processing", e);\r
         } finally {\r