summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/msb/MsbRegister.java53
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();
}
}
-}
+}