Commit 86535a87 by chenweitao

增加httpboot桥接健壮性

parent c884eb1c
...@@ -36,18 +36,18 @@ public class HttpClientUtils { ...@@ -36,18 +36,18 @@ public class HttpClientUtils {
static boolean isInit = false; static boolean isInit = false;
static { static {
init(); init();
isInit = true;
} }
public static HttpBoot getHttpBoot(){ public static HttpBoot getHttpBoot(){
if (!isInit){ if (!isInit){
init(); init();
isInit = true;
} }
return httpBoot; return httpBoot;
} }
public static synchronized void init(){ public static synchronized void init(){
try {
LOGGER.info("http-boot桥接 开始...");
ApplicationConfig applicationConfig = new ApplicationConfig(); ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("hot_search-project"); applicationConfig.setName("hot_search-project");
RegistryConfig registryConfig = new RegistryConfig(); RegistryConfig registryConfig = new RegistryConfig();
...@@ -72,7 +72,11 @@ public class HttpClientUtils { ...@@ -72,7 +72,11 @@ public class HttpClientUtils {
// 初始化 http-boot 桥接 // 初始化 http-boot 桥接
CynomysFactory.init(consumer); CynomysFactory.init(consumer);
LOGGER.info("http-boot 桥接 成功"); isInit = true;
}catch (Exception e){
LOGGER.error("http-boot桥接 出错:",e);
}
LOGGER.info("http-boot桥接 成功");
} }
public static String sendPost(String url, String jsonParam){ public static String sendPost(String url, String jsonParam){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment