You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
refactor(netty): migrate off the deprecated NioEventLoopGroup (Netty 4.2)
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.
This commit is contained in:
@@ -9,7 +9,8 @@ import io.netty.channel.ChannelFuture;
|
|||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
import io.netty.channel.EventLoopGroup;
|
import io.netty.channel.EventLoopGroup;
|
||||||
import io.netty.channel.FixedRecvByteBufAllocator;
|
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.channel.socket.nio.NioServerSocketChannel;
|
||||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -59,8 +60,10 @@ public abstract class Server {
|
|||||||
|
|
||||||
String threadName = name.replace("Server", "").replace(" ", "");
|
String threadName = name.replace("Server", "").replace(" ", "");
|
||||||
|
|
||||||
this.bossGroup = new NioEventLoopGroup(bossGroupThreads, new DefaultThreadFactory(threadName + "Boss"));
|
// Netty 4.2: NioEventLoopGroup is deprecated in favour of the generic
|
||||||
this.workerGroup = new NioEventLoopGroup(workerGroupThreads, new DefaultThreadFactory(threadName + "Worker"));
|
// 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();
|
this.serverBootstrap = new ServerBootstrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user