diff options
author | GuangrongFu <fu.guangrong@zte.com.cn> | 2022-03-03 11:33:59 +0800 |
---|---|---|
committer | GuangrongFu <fu.guangrong@zte.com.cn> | 2022-03-03 11:33:59 +0800 |
commit | 3502d780735b537f29ec398745a7ed264805ac9b (patch) | |
tree | 6d1223cb304d88c6ccda41854bfe335666a65bb0 /rulemgt/src/main/java | |
parent | ecf54e8ad1182aa14b5f942160e1834725a432f9 (diff) |
bugfix - fixed the healthcheck problem
Issue-ID: HOLMES-512
Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
Change-Id: I4393c649468157c00f3ea57568056b087b76554c
Diffstat (limited to 'rulemgt/src/main/java')
-rw-r--r-- | rulemgt/src/main/java/org/onap/holmes/rulemgt/Initializer.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/Initializer.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/Initializer.java index 812ee48..3995e4c 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/Initializer.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/Initializer.java @@ -30,6 +30,7 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; import java.util.HashSet; import java.util.Set; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import static org.onap.holmes.common.utils.CommonUtils.getEnv; @@ -38,7 +39,7 @@ import static org.onap.holmes.common.utils.CommonUtils.isIpAddress; @Service public class Initializer { private static final Logger logger = LoggerFactory.getLogger(Initializer.class); - private static boolean readyForMsbReg = false; + private volatile static boolean readyForMsbReg = false; private MsbRegister msbRegister; @Inject @@ -48,17 +49,19 @@ public class Initializer { @PostConstruct private void init() { - waitUntilReady(); - try { - msbRegister.register2Msb(createMicroServiceInfo()); - } catch (CorrelationException e) { - logger.error(e.getMessage(), e); - } + Executors.newSingleThreadExecutor().execute(() -> { + waitUntilReady(); + try { + msbRegister.register2Msb(createMicroServiceInfo()); + } catch (CorrelationException e) { + logger.error(e.getMessage(), e); + } + }); } private void waitUntilReady() { int count = 1; - while(!readyForMsbReg) { + while (!readyForMsbReg) { if (count > 20) { break; } |