This commit is contained in:
crusader 2018-04-24 11:51:31 +09:00
parent 57eda39031
commit 90dda2f964

View File

@ -29,12 +29,12 @@ public abstract class Server {
protected int threadCountWorker; protected int threadCountWorker;
@Autowired @Autowired
protected List<Class<? extends ServerChannel>> channelClasses; protected Class<? extends ServerChannel> channelClass;
@Autowired @Autowired
protected List<ChannelOptionItem<?>> channelOptions; protected List<ChannelOptionItem<?>> channelOptions;
@Autowired @Autowired
protected List<ChannelHandler> channelHandlers; protected ChannelHandler channelHandler;
@Autowired @Autowired
protected ChannelInitializer<?> channelInitializer; protected ChannelInitializer<?> channelInitializer;
@Autowired @Autowired
@ -48,20 +48,16 @@ public abstract class Server {
ServerBootstrap serverBootstrap = new ServerBootstrap(); ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup); serverBootstrap.group(bossGroup, workerGroup);
if (null != this.channelClasses) { if (null != this.channelClass) {
for (Class<? extends ServerChannel> channelClass : this.channelClasses) { serverBootstrap = serverBootstrap.channel(this.channelClass);
serverBootstrap.channel(channelClass);
}
} }
if (null != this.channelOptions) { if (null != this.channelOptions) {
for (ChannelOptionItem<?> optionItem : this.channelOptions) { for (ChannelOptionItem<?> optionItem : this.channelOptions) {
optionItem.setOption(serverBootstrap); optionItem.setOption(serverBootstrap);
} }
} }
if (null != this.channelHandlers) { if (null != this.channelHandler) {
for (ChannelHandler channelHandler : this.channelHandlers) { serverBootstrap.handler(this.channelHandler);
serverBootstrap.handler(channelHandler);
}
} }
serverBootstrap.childHandler(this.channelInitializer); serverBootstrap.childHandler(this.channelInitializer);