调整NettyServer启动时间

This commit is contained in:
wangshilong 2025-02-18 09:19:01 +08:00
parent 2acf6d2f7c
commit ed1931cd98
1 changed files with 2 additions and 1 deletions

View File

@ -24,7 +24,7 @@ import java.util.Set;
@RestController
@RequestMapping("modbus-tcp")
public class ModbusTCPController implements ApplicationRunner {
public static final NettyServer nettyServer = new NettyServer(502, Math.max(20, Runtime.getRuntime().availableProcessors() - 1));
public static NettyServer nettyServer;
@PreDestroy
private void destroy() {
@ -105,6 +105,7 @@ public class ModbusTCPController implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
nettyServer = new NettyServer(502, Math.max(20, Runtime.getRuntime().availableProcessors() - 1));
nettyServer.start();
}