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