Commit fabdbcfd authored by AfirSraftGarrier's avatar AfirSraftGarrier

格式并加些打印

parent 88980bb9
...@@ -8,8 +8,6 @@ import org.springframework.stereotype.Component; ...@@ -8,8 +8,6 @@ import org.springframework.stereotype.Component;
@Component @Component
@Slf4j @Slf4j
public class ForwardClient { public class ForwardClient {
private TcpClient client = null; private TcpClient client = null;
private ForwardChannelInitializer channelInitializer; private ForwardChannelInitializer channelInitializer;
...@@ -17,7 +15,6 @@ public class ForwardClient { ...@@ -17,7 +15,6 @@ public class ForwardClient {
ForwardClientHandler handler; ForwardClientHandler handler;
public ForwardClient() { public ForwardClient() {
} }
public void startTcp(String host, int port, String appId) { public void startTcp(String host, int port, String appId) {
...@@ -31,5 +28,4 @@ public class ForwardClient { ...@@ -31,5 +28,4 @@ public class ForwardClient {
client = new TcpClient(host, port, channelInitializer, listener); client = new TcpClient(host, port, channelInitializer, listener);
client.start(); client.start();
} }
} }
...@@ -15,7 +15,7 @@ public class TcpClient { ...@@ -15,7 +15,7 @@ public class TcpClient {
private BaseChannelInitializer channelInitializer; private BaseChannelInitializer channelInitializer;
private BaseConnectionListener connectionListener; private BaseConnectionListener connectionListener;
public TcpClient(String host, int port,BaseChannelInitializer channelInitializer,BaseConnectionListener connectionListener) { public TcpClient(String host, int port, BaseChannelInitializer channelInitializer, BaseConnectionListener connectionListener) {
this.host = host; this.host = host;
this.port = port; this.port = port;
this.channelInitializer = channelInitializer; this.channelInitializer = channelInitializer;
...@@ -23,9 +23,7 @@ public class TcpClient { ...@@ -23,9 +23,7 @@ public class TcpClient {
} }
public void start() { public void start() {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(() -> {
@Override
public void run() {
try { try {
EventLoopGroup eventLoopGroup = new NioEventLoopGroup(); EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
Bootstrap bootstrap = new Bootstrap(); Bootstrap bootstrap = new Bootstrap();
...@@ -39,14 +37,9 @@ public class TcpClient { ...@@ -39,14 +37,9 @@ public class TcpClient {
future.addListener(connectionListener); future.addListener(connectionListener);
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block log.error("Tcp客户端异常,端口:{}", port);
log.error("Tcp客户端异常,端口:{}",port);
}
} }
}); });
thread.start(); thread.start();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment