| | |
| | | package com.ard.tianyu.component.netty.handler; |
| | | |
| | | import com.ard.tianyu.domain.cache.TyTcpServerCache; |
| | | import com.ard.tianyu.component.netty.TyNettyTcpClient; |
| | | import com.ard.tianyu.component.netty.NettyTcpClient; |
| | | import com.ard.tianyu.component.netty.command.BaseCmd; |
| | | import com.ard.tianyu.service.ITyService; |
| | | import io.netty.channel.ChannelHandler; |
| | |
| | | private ITyService tyService; |
| | | |
| | | @Resource |
| | | private TyNettyTcpClient tyNettyTcpClient; |
| | | private NettyTcpClient nettyTcpClient; |
| | | |
| | | @Override |
| | | public void channelRead0(ChannelHandlerContext ctx, BaseCmd command) { |
| | |
| | | ctx.channel().eventLoop().schedule(() -> { |
| | | log.error("天宇服务端链接不上,开始重连操作..."); |
| | | try { |
| | | tyNettyTcpClient.initConnection(host, port); |
| | | nettyTcpClient.initConnection(host, port); |
| | | } catch (Exception e) { |
| | | log.error("天宇服务端连接异常: {}", e.getMessage()); |
| | | } |