From 62bff69c3fe1cc30c19ee9f1e637c8a6d7e8e6c6 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Fri, 15 Jan 2021 17:26:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0OkHttp=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/AsyncExecutorConfig.java | 15 --------------- .../server/DipperPositionServer.java | 19 +++++++++++-------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/telpo/dipperposition/config/AsyncExecutorConfig.java b/src/main/java/com/telpo/dipperposition/config/AsyncExecutorConfig.java index e3d8c6b..a339326 100644 --- a/src/main/java/com/telpo/dipperposition/config/AsyncExecutorConfig.java +++ b/src/main/java/com/telpo/dipperposition/config/AsyncExecutorConfig.java @@ -19,8 +19,6 @@ import java.util.concurrent.ThreadPoolExecutor; * @author: linwl * @create: 2020-07-11 09:17 */ -@Getter -@Setter @Configuration @Slf4j public class AsyncExecutorConfig implements AsyncConfigurer { @@ -34,19 +32,6 @@ public class AsyncExecutorConfig implements AsyncConfigurer { @Value("${async.pool.queueCapacity}") private int queueCapacity; - - @Value(value = "${position.server.serverAddr}") - private String serverAddr; - - @Value(value = "${position.server.timeAsycPort}") - private String timeAsycServerPort; - - @Value(value = "${position.server.posAsycPort}") - private String posAsycServerPort; - - @Value(value = "${position.server.starsAsycPort}") - private String starsAsycServerPort; - @Bean(name = "asyncServiceExecutor") public Executor asyncServiceExecutor() { log.info("start asyncServiceExecutor"); diff --git a/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java b/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java index 82f5759..c9c0fe6 100644 --- a/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java +++ b/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java @@ -27,6 +27,11 @@ import java.net.InetSocketAddress; @Slf4j public class DipperPositionServer { + private String serverAddr="172.16.192.26"; + private String timeAsycServerPort="9011"; + private String posAsycServerPort="9013"; + private String starsAsycServerPort="9012"; + @Autowired AsyncExecutorConfig positionConfig; /* @@ -34,14 +39,12 @@ public class DipperPositionServer { */ public void startTimeAsnc() { - log.debug("Server is :", positionConfig.getServerAddr()); - log.debug("Port is :", positionConfig.getTimeAsycServerPort()); //new 一个主线程组 EventLoopGroup mainThreadGroup = new NioEventLoopGroup(1); //new 一个工作线程组 EventLoopGroup workThreadGroup = new NioEventLoopGroup(200); - InetSocketAddress socketAddress = new InetSocketAddress(positionConfig.getServerAddr(), - Integer.parseInt("9101")); + InetSocketAddress socketAddress = new InetSocketAddress(serverAddr, + Integer.parseInt(timeAsycServerPort)); ServerBootstrap bootstrap = new ServerBootstrap() .group(mainThreadGroup, workThreadGroup) .channel(NioServerSocketChannel.class) @@ -79,8 +82,8 @@ public class DipperPositionServer { EventLoopGroup mainThreadGroup = new NioEventLoopGroup(1); //new 一个工作线程组 EventLoopGroup workThreadGroup = new NioEventLoopGroup(200); - InetSocketAddress socketAddress = new InetSocketAddress(positionConfig.getServerAddr(), - Integer.parseInt(positionConfig.getPosAsycServerPort())); + InetSocketAddress socketAddress = new InetSocketAddress(serverAddr, + Integer.parseInt(posAsycServerPort)); ServerBootstrap bootstrap = new ServerBootstrap() .group(mainThreadGroup, workThreadGroup) .channel(NioServerSocketChannel.class) @@ -119,8 +122,8 @@ public class DipperPositionServer { EventLoopGroup mainThreadGroup = new NioEventLoopGroup(1); //new 一个工作线程组 EventLoopGroup workThreadGroup = new NioEventLoopGroup(200); - InetSocketAddress socketAddress = new InetSocketAddress(positionConfig.getServerAddr(), - Integer.parseInt(positionConfig.getStarsAsycServerPort())); + InetSocketAddress socketAddress = new InetSocketAddress(serverAddr, + Integer.parseInt(starsAsycServerPort)); ServerBootstrap bootstrap = new ServerBootstrap() .group(mainThreadGroup, workThreadGroup) .channel(NioServerSocketChannel.class)