From 62104596ac483f6662f7ac4da4438e89a6cbd002 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Tue, 9 Jun 2026 16:19:58 +0000 Subject: [PATCH] refactor(netty): migrate off the deprecated NioEventLoopGroup (Netty 4.2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Netty 4.2 deprecates NioEventLoopGroup in favour of the generic MultiThreadIoEventLoopGroup driven by an IoHandlerFactory. Server.java now builds its boss/worker groups with MultiThreadIoEventLoopGroup(.., NioIoHandler.newFactory()) — functionally equivalent, and the codebase now compiles with zero deprecation warnings. Verified: compile, 15/15 tests, shaded jar. --- .../src/main/java/com/eu/habbo/networking/Server.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Emulator/src/main/java/com/eu/habbo/networking/Server.java b/Emulator/src/main/java/com/eu/habbo/networking/Server.java index 4062141c..61258f2d 100644 --- a/Emulator/src/main/java/com/eu/habbo/networking/Server.java +++ b/Emulator/src/main/java/com/eu/habbo/networking/Server.java @@ -9,7 +9,8 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.FixedRecvByteBufAllocator; -import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.MultiThreadIoEventLoopGroup; +import io.netty.channel.nio.NioIoHandler; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.util.concurrent.DefaultThreadFactory; import org.slf4j.Logger; @@ -59,8 +60,10 @@ public abstract class Server { String threadName = name.replace("Server", "").replace(" ", ""); - this.bossGroup = new NioEventLoopGroup(bossGroupThreads, new DefaultThreadFactory(threadName + "Boss")); - this.workerGroup = new NioEventLoopGroup(workerGroupThreads, new DefaultThreadFactory(threadName + "Worker")); + // Netty 4.2: NioEventLoopGroup is deprecated in favour of the generic + // MultiThreadIoEventLoopGroup driven by an IoHandlerFactory (NIO here). + this.bossGroup = new MultiThreadIoEventLoopGroup(bossGroupThreads, new DefaultThreadFactory(threadName + "Boss"), NioIoHandler.newFactory()); + this.workerGroup = new MultiThreadIoEventLoopGroup(workerGroupThreads, new DefaultThreadFactory(threadName + "Worker"), NioIoHandler.newFactory()); this.serverBootstrap = new ServerBootstrap(); }