Commit 499905bd by leiliangliang

Merge remote-tracking branch 'origin/working' into working

parents 2978b037 86535a87
...@@ -36,43 +36,47 @@ public class HttpClientUtils { ...@@ -36,43 +36,47 @@ 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(){
ApplicationConfig applicationConfig = new ApplicationConfig(); try {
applicationConfig.setName("hot_search-project"); LOGGER.info("http-boot桥接 开始...");
RegistryConfig registryConfig = new RegistryConfig(); ApplicationConfig applicationConfig = new ApplicationConfig();
ConsumerConfig consumerConfig = new ConsumerConfig(); applicationConfig.setName("hot_search-project");
String username = null; RegistryConfig registryConfig = new RegistryConfig();
String password = null; ConsumerConfig consumerConfig = new ConsumerConfig();
if (ProxyConfig.isLocal) { String username = null;
registryConfig.setAddress(ProxyConfig.localRegistry); String password = null;
// 设置分组 if (ProxyConfig.isLocal) {
consumerConfig.setGroup(ProxyConfig.localGroup); registryConfig.setAddress(ProxyConfig.localRegistry);
username = ProxyConfig.localUsername; // 设置分组
password = ProxyConfig.localPassword; consumerConfig.setGroup(ProxyConfig.localGroup);
} else { username = ProxyConfig.localUsername;
registryConfig.setAddress(ProxyConfig.hangzhouRegistry); password = ProxyConfig.localPassword;
// 设置分组 } else {
consumerConfig.setGroup(ProxyConfig.hangzhouGroup); registryConfig.setAddress(ProxyConfig.hangzhouRegistry);
username = ProxyConfig.hangzhouUsername; // 设置分组
password = ProxyConfig.hangzhouPassword; consumerConfig.setGroup(ProxyConfig.hangzhouGroup);
} username = ProxyConfig.hangzhouUsername;
// 创建 consumer,applicationConfig 非必需参数 password = ProxyConfig.hangzhouPassword;
CynomysConsumer consumer = CynomysConsumerFactory.create(applicationConfig, registryConfig, consumerConfig, username, password); }
// 创建 consumer,applicationConfig 非必需参数
CynomysConsumer consumer = CynomysConsumerFactory.create(applicationConfig, registryConfig, consumerConfig, username, password);
// 初始化 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