diff --git a/src/main/java/com/loafle/commons/server/Server.java b/src/main/java/com/loafle/commons/server/Server.java index 673a83e..ccc6b3c 100644 --- a/src/main/java/com/loafle/commons/server/Server.java +++ b/src/main/java/com/loafle/commons/server/Server.java @@ -29,12 +29,12 @@ public abstract class Server { protected int threadCountWorker; @Autowired - protected List> channelClasses; + protected Class channelClass; @Autowired protected List> channelOptions; @Autowired - protected List channelHandlers; + protected ChannelHandler channelHandler; @Autowired protected ChannelInitializer channelInitializer; @Autowired @@ -48,20 +48,16 @@ public abstract class Server { ServerBootstrap serverBootstrap = new ServerBootstrap(); serverBootstrap.group(bossGroup, workerGroup); - if (null != this.channelClasses) { - for (Class channelClass : this.channelClasses) { - serverBootstrap.channel(channelClass); - } + if (null != this.channelClass) { + serverBootstrap = serverBootstrap.channel(this.channelClass); } if (null != this.channelOptions) { for (ChannelOptionItem optionItem : this.channelOptions) { optionItem.setOption(serverBootstrap); } } - if (null != this.channelHandlers) { - for (ChannelHandler channelHandler : this.channelHandlers) { - serverBootstrap.handler(channelHandler); - } + if (null != this.channelHandler) { + serverBootstrap.handler(this.channelHandler); } serverBootstrap.childHandler(this.channelInitializer);