if (builder.ioPool == null) {
this.ioPool = new NioEventLoopGroup(ioPoolSize(), new DefaultThreadFactory("cb-io", true));
this.ioPoolShutdownHook = new IoPoolShutdownHook(this.ioPool);
} else {
this.ioPool = builder.ioPool;
this.ioPoolShutdownHook = builder.ioPoolShutdownHook == null
? new NoOpShutdownHook()
: builder.ioPoolShutdownHook;
}
I would like to switch to Epoll leaving other env-params with their default values, so:
final EpollEventLoopGroup elg =
new EpollEventLoopGroup(
DefaultCouchbaseEnvironment.IO_POOL_SIZE,
new DefaultThreadFactory("cb-io", true)
);
final ShutdownHook hook =
new IoPoolShutdownHook(elg);
ce = DefaultCouchbaseEnvironment
.builder()
.ioPool(elg, hook)
.build();
Is it a “correct switching to epoll” or i need to do something more ?
Oh and don’t forget to shut it down manually during teardown since you are passing it from the outside we don’t own it and as a result don’t automatically shut it down.
Oh sorry I didn’t say it clearly: if you provide the shutdown hook we’ll shut it down for you, but if you use it in other places as well don’t set a shutdown hook and shut it down on your own… for example if you share the group with some other code then it might make sense to defer shutdown until that other component is clean as well.