| | |
| | | package com.ard.tianyu.netty.handler; |
| | | |
| | | import com.ard.tianyu.model.cache.TyTcpServerCache; |
| | | import com.ard.tianyu.netty.TyNettyTcpClient; |
| | | import com.ard.tianyu.netty.command.BaseCmd; |
| | | import com.ard.tianyu.service.ITyService; |
| | |
| | | @Override |
| | | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { |
| | | log.error("发生异常: ", cause); // 使用日志记录异常 |
| | | ctx.close(); |
| | | // ctx.close(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | int port = ipSocket.getPort(); |
| | | String host = ipSocket.getHostString(); |
| | | log.error("与天宇服务{}:{}连接断开!", host, port); |
| | | |
| | | TyTcpServerCache.putTcpServerCache(host + ":" + port, false); |
| | | ctx.channel().eventLoop().schedule(() -> { |
| | | log.error("天宇服务端链接不上,开始重连操作..."); |
| | | try { |