diff options
author | Murali Mohan Murthy Potham <murali.p@huawei.com> | 2017-09-21 13:11:28 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-21 13:11:28 +0000 |
commit | 8f935893a77a7464dfe3ae39fa31c708fc6ede48 (patch) | |
tree | 0dcbfc292bca876b7e589976ac328441d1af4205 /vnfmarket-be | |
parent | 8b59704cb53bce9bb9b856b8bc7feeac0083bc9e (diff) | |
parent | a215f9704e4f17ec5b00664e83d843b45884fd3e (diff) |
Merge "reduce break to one"
Diffstat (limited to 'vnfmarket-be')
-rw-r--r-- | vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbRegister.java | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbRegister.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbRegister.java index 3e4699e8..1b05af14 100644 --- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbRegister.java +++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbRegister.java @@ -23,58 +23,63 @@ import org.slf4j.LoggerFactory; public class MsbRegister { private static final Logger logger = LoggerFactory.getLogger(MsbRegister.class); - + + private MsbRegister() { + } + /** * Interface top handle MSB Registration */ - public static void handleMsbRegistration() + public static void handleMsbRegistration() { logger.info("VNF-SDK Market Place microservice register start."); int retry = 0; - while(CommonConstant.MsbRegisterCode.MSDB_REGISTER_RETRIES >= retry) - { + while(CommonConstant.MsbRegisterCode.MSDB_REGISTER_RETRIES >= retry) + { int retCode = MsbRegistration.getInstance().register(); - if(CommonConstant.MsbRegisterCode.MSDB_REGISTER_FILE_NOT_EXISTS == retCode) - { - logger.info("microservice register failed, MSB Register File Not Exists !"); - break; - } - - if(CommonConstant.MsbRegisterCode.MSDB_REGISTER_SUCESS != retCode) + + if(CommonConstant.MsbRegisterCode.MSDB_REGISTER_SUCESS != retCode) { logger.warn("microservice register failed, try again after(ms):" + CommonConstant.MsbRegisterCode.MSDB_REGISTER_RETRY_SLEEP); threadSleep(CommonConstant.MsbRegisterCode.MSDB_REGISTER_RETRY_SLEEP); - } - else + } + else { - logger.info("microservice register success !"); + if(CommonConstant.MsbRegisterCode.MSDB_REGISTER_FILE_NOT_EXISTS == retCode) + { + logger.info("microservice register failed, MSB Register File Not Exists !"); + } + else + { + logger.info("microservice register success !"); + } break; - } - + } + retry++; logger.info("VNF-SDK Market Place microservice register [retry count]:" + retry); } logger.info("VNF-SDK Market Place microservice register end."); } - - public static void handleMsbUnRegistration() + + public static void handleMsbUnRegistration() { logger.info("VNF-SDK Market Place microservice handleMsbUnRegistration Start."); MsbRegistration.getInstance().unRegister(); logger.info("VNF-SDK Market Place microservice handleMsbUnRegistration end."); } - - private static void threadSleep(int second) + + private static void threadSleep(int second) { - try + try { Thread.sleep(second); - } - catch(InterruptedException error) + } + catch(InterruptedException error) { logger.error("thread sleep error.errorMsg:", error); Thread.currentThread().interrupt(); } } -} +} |