| | |
| | | import io.netty.util.concurrent.EventExecutorGroup; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * updServer udp服务端 |
| | | * |
| | | * @author zhongrj |
| | | * @date 2023-02-21 |
| | | */ |
| | |
| | | //给管道抽象出接口,给Channel更多的能力和配置,例如Channel的状态,参数,IO操作 |
| | | //使用ChannelPipeline实现自定义IO |
| | | //Channel channel; |
| | | @Async("taskExecutor") |
| | | public void run(int port) { |
| | | Thread thread = new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // Thread thread = new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | //启动服务 |
| | | EventLoopGroup workerGroup = new NioEventLoopGroup(); |
| | | //优化使用的线程 |
| | |
| | | group.shutdownGracefully(); |
| | | workerGroup.shutdownGracefully(); |
| | | } |
| | | } |
| | | }); |
| | | thread.start(); |
| | | // } |
| | | // }); |
| | | // thread.start(); |
| | | } |
| | | |
| | | } |