Bladeren bron

修改到docker外运行环境

tags/v1.0.0^2
林万龙 3 jaren geleden
bovenliggende
commit
e878a142a0
2 gewijzigde bestanden met toevoegingen van 7 en 4 verwijderingen
  1. +2
    -0
      src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java
  2. +5
    -4
      src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java

+ 2
- 0
src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java Bestand weergeven

@@ -124,6 +124,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// if (Integer.parseInt(posAsycServerPort) == channel.localAddress().getPort()) {

//if (AST_POS_CMD.equals(recvmg)) {
log.info("config info is : " + positionConfig.getCenterProvinceFilePath() + positionConfig.getCenterProvince() + positionConfig.getIpPositionRequestPath() +
positionConfig.getIpPositionRequestKey());
if (AST_POS_CMD.equals(msg)) {
// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress,
// positionConfig.getCenterProvinceFilePath(),


+ 5
- 4
src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java Bestand weergeven

@@ -158,12 +158,12 @@ public class DipperPositionServer {
EventLoopGroup mainThreadGroup = new NioEventLoopGroup(1);
//new 一个工作线程组
EventLoopGroup workThreadGroup = new NioEventLoopGroup(200);
//InetSocketAddress socketAddress = new InetSocketAddress(serverAddr,null);
InetSocketAddress socketAddress = new InetSocketAddress(serverAddr,9011);
ServerBootstrap bootstrap = new ServerBootstrap()
.group(mainThreadGroup, workThreadGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new ServerChannelInitializer())
//.localAddress(socketAddress)
.localAddress(socketAddress)
//设置队列大小
.option(ChannelOption.SO_BACKLOG, 1024)
// 两小时内没有数据的通信时,TCP会自动发送一个活动探测数据报文
@@ -181,6 +181,7 @@ public class DipperPositionServer {
System.out.println("start failed");
}
});
channelFuture.channel().closeFuture().sync();

ChannelFuture channelFuture2 = bootstrap.bind(posAsycPort).sync();
log.info("位置服务器启动开始监听端口: {}", posAsycPort);
@@ -191,6 +192,7 @@ public class DipperPositionServer {
System.out.println("start failed");
}
});
channelFuture2.channel().closeFuture().sync();


ChannelFuture channelFuture3 = bootstrap.bind(starsAsycPort).sync();
@@ -202,8 +204,7 @@ public class DipperPositionServer {
System.out.println("start failed");
}
});

//channelFuture.channel().closeFuture().sync();
channelFuture3.channel().closeFuture().sync();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {


Laden…
Annuleren
Opslaan