start up failed without msb 55/71055/1
authorromaingimbert <romain.gimbert@orange.com>
Tue, 23 Oct 2018 13:14:29 +0000 (15:14 +0200)
committerromaingimbert <romain.gimbert@orange.com>
Tue, 23 Oct 2018 13:14:29 +0000 (15:14 +0200)
-fix code

Change-Id: I17c5ca36dd4c3995addbef7061af17782d721890
Issue-ID: EXTAPI-164
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
src/main/java/org/onap/nbi/ServiceRegisterRunner.java

index 8c10e56..ed10a65 100644 (file)
@@ -121,7 +121,7 @@ public class ServiceRegisterRunner implements CommandLineRunner {
         );
 
         int attempt = 0;
-        while (true) {
+        while (attempt<RETRY) {
             attempt += 1;
             try {
                 logger.info("Registration with msb discovery (attempt {}/{})", attempt, RETRY);
@@ -130,11 +130,8 @@ public class ServiceRegisterRunner implements CommandLineRunner {
                 logger.debug("Registration with msb discovery done, microServiceFullInfo = {}", microServiceFullInfo.toString());
                 break;
             } catch (Exception ex) {
-                if (attempt == RETRY) {
-                    throw new Exception("Registration with msb discovery FAILED");
-                }
+                logger.info("Registration with msb discovery (attempt {}/{}) FAILED. Sleep {}ms", attempt, RETRY, RETRY_INTERVAL);
             }
-            logger.info("Registration with msb discovery (attempt {}/{}) FAILED. Sleep {}ms", attempt, RETRY, RETRY_INTERVAL);
             Thread.sleep(RETRY_INTERVAL);
         }
     }