文件名从 src/main/java/com/ard/utils/tcp/DynamicClient.java 修改 |
| | |
| | | package com.ard.utils.tcp; |
| | | package com.ard.utils.netty.tcp; |
| | | |
| | | import com.ard.alarm.radar.domain.ArdEquipRadar; |
| | | import com.ard.alarm.radar.service.IArdEquipRadarService; |
| | | import com.ard.utils.netty.config.NettyTcpConfiguration; |
| | | import io.netty.bootstrap.Bootstrap; |
| | | import io.netty.channel.*; |
| | | import io.netty.channel.nio.NioEventLoopGroup; |
| | | import io.netty.channel.socket.nio.NioSocketChannel; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.stereotype.Component; |
| | | import javax.annotation.Resource; |
| | |
| | | public class DynamicClient { |
| | | @Resource |
| | | IArdEquipRadarService ardEquipRadarService; |
| | | |
| | | @Value("${spring.netty.tcp.enabled}") |
| | | private Boolean tcpClientEnable; |
| | | @Resource |
| | | NettyTcpConfiguration nettyTcpConfig; |
| | | |
| | | private static List<Channel> serverChannels = new ArrayList<>(); |
| | | public static ConcurrentHashMap<Channel, ArdEquipRadar> ConnectMap = new ConcurrentHashMap(); |
| | |
| | | */ |
| | | //@Override |
| | | public void run(ApplicationArguments args) { |
| | | if (!tcpClientEnable) { |
| | | if (!nettyTcpConfig.getEnabled()) { |
| | | return; |
| | | } |
| | | EventLoopGroup group = new NioEventLoopGroup(); |