Browse Source

修改到docker外运行环境

tags/v1.0.0^2
林万龙 3 years ago
parent
commit
e878a142a0
2 changed files with 7 additions and 4 deletions
  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 View File

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


//if (AST_POS_CMD.equals(recvmg)) { //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)) { if (AST_POS_CMD.equals(msg)) {
// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress, // channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress,
// positionConfig.getCenterProvinceFilePath(), // positionConfig.getCenterProvinceFilePath(),


+ 5
- 4
src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java View File

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


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




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

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


Loading…
Cancel
Save