* Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the
* start method that will handle sockets in different thread.
*/
-public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends SessionListener<?, ?, ?>> implements Closeable {
+public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends SessionListener<?, ?, ?>> {
protected interface PipelineInitializer<S extends ProtocolSession<?>> {
/**
private final EventLoopGroup workerGroup;
-
- /**
- * Internally creates new instances of NioEventLoopGroup, might deplete system resources and result in Too many open files exception.
- *
- * @deprecated use {@link AbstractDispatcher#AbstractDispatcher(io.netty.channel.EventLoopGroup, io.netty.channel.EventLoopGroup)} instead.
- */
- @Deprecated
- protected AbstractDispatcher() {
- this(new NioEventLoopGroup(),new NioEventLoopGroup());
- }
-
protected AbstractDispatcher(EventLoopGroup bossGroup, EventLoopGroup workerGroup) {
this.bossGroup = bossGroup;
this.workerGroup = workerGroup;
}
- @Override
- public void close() {
- try {
- this.workerGroup.shutdownGracefully();
- } finally {
- this.bossGroup.shutdownGracefully();
- }
- }
}