Open hongroumeng opened 3 years ago
同样的问题 设计不合理 看看怎么改
private static ConsulClient getConsulClient() { if (client == null) { synchronized (ConsulConfiguration.class) { if (client == null) { String serverAddr = FILE_CONFIG.getConfig(FILE_CONFIG_KEY_PREFIX + SERVER_ADDR_KEY); InetSocketAddress inetSocketAddress = NetUtil.toInetSocketAddress(serverAddr); client = new ConsulClient(inetSocketAddress.getHostName(), inetSocketAddress.getPort()); } } } return client; }
迟迟不能返回 consul的address
seata-spring-boot-starter: 1.5.1.1,问题依然存在
Ⅰ. Issue Description
启动获取配置中心consul配置参数失败,导致启动时间过长
Ⅱ. Describe what happened
Ⅲ. Describe what you expected to happen
从配置中心consul获取到正确配置数据
Ⅳ. How to reproduce it (as minimally and precisely as possible)
Ⅴ. Anything else we need to know?
通过断点调试,发现类ConsulConfiguration.getLatestConfig()方法中获取consul配置使用了线程池,主线程没有等到读取完配置就返回了,所以产生了上述日志
Ⅵ. Environment: