Commit 2942e5a1 authored by duanruiming's avatar duanruiming

[update] 代码优化

parent 0998ed96
...@@ -30,6 +30,6 @@ public class Application implements CommandLineRunner { ...@@ -30,6 +30,6 @@ public class Application implements CommandLineRunner {
@Override @Override
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
NettyClient.start(localPort, remoteProt); NettyClient.connection(localPort, remoteProt);
} }
} }
...@@ -36,7 +36,7 @@ public class NettyClient { ...@@ -36,7 +36,7 @@ public class NettyClient {
/** /**
* 建立连接 * 建立连接
*/ */
public static void start(int localPort, int remotePort) throws InterruptedException { public static void connection(int localPort, int remotePort) throws InterruptedException {
EventLoopGroup group = new NioEventLoopGroup(); EventLoopGroup group = new NioEventLoopGroup();
Bootstrap bootstrap = new Bootstrap(); Bootstrap bootstrap = new Bootstrap();
bootstrap.group(group) bootstrap.group(group)
...@@ -101,7 +101,7 @@ public class NettyClient { ...@@ -101,7 +101,7 @@ public class NettyClient {
NettyMessageCache.NETTY_MESSAGE_RESULT_MAP.forEach((k, v) -> { NettyMessageCache.NETTY_MESSAGE_RESULT_MAP.forEach((k, v) -> {
threadPoolExecutor.execute(() -> { threadPoolExecutor.execute(() -> {
if (now - v.getStartTime() > v.getWaitMillisecond()) { if (now - v.getStartTime() > v.getWaitMillisecond()) {
log.warn("wait {}ms {} timeout", v.getWaitMillisecond(), k); log.warn("wait {}ms [{}] timeout", v.getWaitMillisecond(), k);
v.getCountDownLatch().countDown(); v.getCountDownLatch().countDown();
} }
}); });
......
...@@ -16,7 +16,7 @@ import java.util.Map; ...@@ -16,7 +16,7 @@ import java.util.Map;
@Component @Component
public class UtcFeignClientCache implements CommandLineRunner { public class UtcFeignClientCache implements CommandLineRunner {
public static final Map<String, UtcFeignCommon> utcFeignClientsMap = new HashMap(); public static final Map<String, UtcFeignCommon> utcFeignClientsMap = new HashMap<>();
public UtcFeignCommon getUtcFeignClientService(String name) { public UtcFeignCommon getUtcFeignClientService(String name) {
if (!utcFeignClientsMap.isEmpty()) { if (!utcFeignClientsMap.isEmpty()) {
......
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