diff options
author | Harry Huang <huangxiangyu5@huawei.com> | 2017-09-21 20:39:57 +0800 |
---|---|---|
committer | Harry Huang <huangxiangyu5@huawei.com> | 2017-09-21 20:40:50 +0800 |
commit | a215f9704e4f17ec5b00664e83d843b45884fd3e (patch) | |
tree | a5d8237d50af12afca623a9921f249374467a439 /vnfmarket-be/vnf-sdk-marketplace | |
parent | 1d2cfe589baddb0f1586f6eb1e2fdbb0cd43e562 (diff) |
reduce break to one
major: L23 L34
Change-Id: I1edeee1cb5c1523648e53a263090484f0f16e907
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Issue-Id: VNFSDK-85
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace')
-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(); } } -} +} |