Bläddra i källkod

增加OkHttp配置文件读取

tags/v1.0.0^2
林万龙 3 år sedan
förälder
incheckning
62bff69c3f
2 ändrade filer med 11 tillägg och 23 borttagningar
  1. +0
    -15
      src/main/java/com/telpo/dipperposition/config/AsyncExecutorConfig.java
  2. +11
    -8
      src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java

+ 0
- 15
src/main/java/com/telpo/dipperposition/config/AsyncExecutorConfig.java Visa fil

@@ -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");


+ 11
- 8
src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java Visa fil

@@ -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)


Laddar…
Avbryt
Spara