Check if Epoll is avaible when construct EpollEventLoopGroup

Motivation:

We should call Epoll.ensureAvailability() when init EpollEventLoopGroup to fail fast and with a proper exception.

Modifications:

Call Epoll.ensureAvailability() during EpollEventLoopGroup init.

Result:

Fail fast if epoll is not availability (for whatever reason).
This commit is contained in:
Norman Maurer 2017-01-17 16:12:26 +01:00
parent dcf4292647
commit 8381e7b435

View File

@ -91,12 +91,14 @@ public final class EpollEventLoopGroup extends MultithreadEventLoopGroup {
public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce,
SelectStrategyFactory selectStrategyFactory) {
super(nThreads, threadFactory, maxEventsAtOnce, selectStrategyFactory, RejectedExecutionHandlers.reject());
Epoll.ensureAvailability();
}
public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce,
SelectStrategyFactory selectStrategyFactory,
RejectedExecutionHandler rejectedExecutionHandler) {
super(nThreads, threadFactory, maxEventsAtOnce, selectStrategyFactory, rejectedExecutionHandler);
Epoll.ensureAvailability();
}
/**