| | |
| | | package com.zy.core.netty; |
| | | |
| | | |
| | | import com.zy.common.utils.News; |
| | | import com.zy.core.netty.properties.TcpProperties; |
| | | import io.netty.bootstrap.ServerBootstrap; |
| | | import io.netty.buffer.PooledByteBufAllocator; |
| | |
| | | |
| | | ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED); |
| | | |
| | | log.info("TCP server started successfully, port:{}", tcpProperties.getPort()); |
| | | News.info("TCP server started successfully, port:{}", tcpProperties.getPort()); |
| | | |
| | | channel = bootstrap.bind(tcpProperties.getPort()).sync().channel(); |
| | | } |
| | |
| | | if (workerGroup != null) { |
| | | workerGroup.shutdownGracefully(); |
| | | } |
| | | log.info("TCP server stopped successfully, port: {}", tcpProperties.getPort()); |
| | | News.info("TCP server stopped successfully, port: {}", tcpProperties.getPort()); |
| | | } |
| | | |
| | | } |