测试提交
This commit is contained in:
@@ -105,7 +105,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
msg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||
msg.setData(JSON.toJSONString(sourceParam));
|
||||
String s = userPageId + "_Source";
|
||||
NettyClient.socketClient(ip, port, new NettySourceClientHandler(s, sourceResponseService));
|
||||
NettyClient.socketClient(ip, port,userPageId, new NettySourceClientHandler(s, sourceResponseService));
|
||||
SocketManager.sendMsg(s,JSON.toJSONString(msg));
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
String ddId = param.getUserPageId();
|
||||
Channel channel = SocketManager.getChannelByUserId(ddId);
|
||||
if( channel== null || !channel.isActive()){
|
||||
NettyClient.socketClient(ip, port,new NettySourceClientHandler(ddId, sourceResponseService));
|
||||
NettyClient.socketClient(ip, port,param.getUserPageId(),new NettySourceClientHandler(ddId, sourceResponseService));
|
||||
}
|
||||
SocketManager.sendMsg(ddId,"start\n");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
@@ -36,7 +37,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class NettyClient {
|
||||
|
||||
|
||||
public static void socketClient(String ip, Integer port,SimpleChannelInboundHandler<String> handler) {
|
||||
public static void socketClient(String ip, Integer port,String userPageId,SimpleChannelInboundHandler<String> handler) {
|
||||
NioEventLoopGroup group = new NioEventLoopGroup();
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
try {
|
||||
@@ -69,6 +70,7 @@ public class NettyClient {
|
||||
group.shutdownGracefully();
|
||||
//TODO 通知页面
|
||||
|
||||
|
||||
}finally {
|
||||
System.out.println("进入clientSocket最后步骤---------------------");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user