diff --git a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java index 86868d7..f82c58b 100644 --- a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java +++ b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java @@ -6,6 +6,9 @@ import com.telpo.dipperposition.enums.DipperReturnValue; import com.telpo.dipperposition.service.IDipperAstPosAsyncTaskService; import com.telpo.dipperposition.service.IDipperAstTimeAsyncTaskService; import com.telpo.dipperposition.service.IDipperDataAsyncTaskService; +import com.telpo.dipperposition.service.impl.DipperAstPosAsyncTaskServiceImpl; +import com.telpo.dipperposition.service.impl.DipperAstTimeAsyncTaskServiceImpl; +import com.telpo.dipperposition.service.impl.DipperDataAsyncTaskServiceImpl; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.socket.SocketChannel; @@ -110,6 +113,9 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { //if (AST_TIME_CMD.equals(recvmg)) { if (AST_TIME_CMD.equals(msg)) { // 初始时间辅助输入; + if (dipperTimeAsyncTaskService == null) { + dipperTimeAsyncTaskService = new DipperAstTimeAsyncTaskServiceImpl(); + } channelAns = dipperTimeAsyncTaskService.pushAstTime(); } @@ -123,6 +129,9 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { // positionConfig.getCenterProvince(), // positionConfig.getIpPositionRequestPath(), // positionConfig.getIpPositionRequestKey()); + if (dipperAstPosAsyncTaskService == null) { + dipperAstPosAsyncTaskService = new DipperAstPosAsyncTaskServiceImpl(); + } channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress, "/csv/provinceLonAlt.csv", "湖北省", @@ -134,6 +143,9 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { //if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { //if (AST_POS_CMD.equals(recvmg)) { if (AST_POS_CMD.equals(msg)) { + if (dipperDataAsyncTaskService == null) { + dipperDataAsyncTaskService = new DipperDataAsyncTaskServiceImpl(); + } channelAns = dipperDataAsyncTaskService.getAstEPH(); }