Class EpollIoHandler
java.lang.Object
io.netty.channel.epoll.EpollIoHandler
- All Implemented Interfaces:
IoHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate static final longprivate static final longprivate FileDescriptorprivate FileDescriptorprivate final EpollEventArrayprivate final ThreadAwareExecutorprivate static final InternalLoggerprivate static final longprivate final NativeArraysprivate final AtomicLongprivate static final longprivate intprivate booleanprivate longprivate final IntObjectMap<EpollIoHandler.DefaultEpollIoRegistration> private final IntSupplierprivate final SelectStrategyprivate FileDescriptor -
Constructor Summary
ConstructorsConstructorDescriptionEpollIoHandler(ThreadAwareExecutor executor, int maxEvents, SelectStrategy strategy) -
Method Summary
Modifier and TypeMethodDescriptionprivate static EpollIoHandleprivate static EpollIoOpsprivate static voidvoidThis method is intended for use by process checkpoint/restore integration, such as OpenJDK CRaC.voiddestroy()Destroy theIoHandlerand free all its resources.private intprivate longepollWait(IoHandlerContext context, long deadlineNanos) private intprivate intprivate int(package private) voidVisible only for testing!booleanisCompatible(Class<? extends IoHandle> handleType) Returnstrueif the given type is compatible with thisIoHandlerand so can be registered,falseotherwise.static IoHandlerFactoryReturns a newIoHandlerFactorythat createsEpollIoHandlerinstances.static IoHandlerFactorynewFactory(int maxEvents, SelectStrategyFactory selectStrategyFactory) Returns a newIoHandlerFactorythat createsEpollIoHandlerinstances.(package private) intvoidThis method is intended for use by a process checkpoint/restore integration, such as OpenJDK CRaC.voidPrepare to destroy thisIoHandler.private intprocessReady(EpollEventArray events, int ready) Register aIoHandlefor IO.intrun(IoHandlerContext context) Run the IO handled by thisIoHandler.voidwakeup()Wakeup theIoHandler, which means if any operation blocks it should be unblocked and return as soon as possible.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IoHandler
initialize
-
Field Details
-
logger
-
EPOLL_WAIT_MILLIS_THRESHOLD
private static final long EPOLL_WAIT_MILLIS_THRESHOLD -
prevDeadlineNanos
private long prevDeadlineNanos -
epollFd
-
eventFd
-
timerFd
-
registrations
-
allowGrowing
private final boolean allowGrowing -
events
-
nativeArrays
-
selectStrategy
-
selectNowSupplier
-
executor
-
AWAKE
private static final long AWAKE- See Also:
-
NONE
private static final long NONE- See Also:
-
nextWakeupNanos
-
pendingWakeup
private boolean pendingWakeup -
numChannels
private int numChannels -
MAX_SCHEDULED_TIMERFD_NS
private static final long MAX_SCHEDULED_TIMERFD_NS- See Also:
-
-
Constructor Details
-
EpollIoHandler
EpollIoHandler(ThreadAwareExecutor executor, int maxEvents, SelectStrategy strategy)
-
-
Method Details
-
newFactory
Returns a newIoHandlerFactorythat createsEpollIoHandlerinstances. -
newFactory
public static IoHandlerFactory newFactory(int maxEvents, SelectStrategyFactory selectStrategyFactory) Returns a newIoHandlerFactorythat createsEpollIoHandlerinstances. -
cast
-
cast
-
openFileDescriptors
This method is intended for use by a process checkpoint/restore integration, such as OpenJDK CRaC. -
closeFileDescriptor
-
wakeup
-
prepareToDestroy
public void prepareToDestroy()Description copied from interface:IoHandlerPrepare to destroy thisIoHandler. This method will be called beforeIoHandler.destroy()and may be called multiple times.- Specified by:
prepareToDestroyin interfaceIoHandler
-
destroy
-
register
-
isCompatible
Description copied from interface:IoHandlerReturnstrueif the given type is compatible with thisIoHandlerand so can be registered,falseotherwise.- Specified by:
isCompatiblein interfaceIoHandler- Parameters:
handleType- the type of theIoHandle.- Returns:
- if compatible of not.
-
numRegisteredChannels
int numRegisteredChannels() -
registeredChannelsList
-
epollWait
- Throws:
IOException
-
epollWaitNoTimerChange
- Throws:
IOException
-
epollWaitNow
- Throws:
IOException
-
epollBusyWait
- Throws:
IOException
-
epollWaitTimeboxed
- Throws:
IOException
-
run
Description copied from interface:IoHandlerRun the IO handled by thisIoHandler. TheIoHandlerContextshould be used to ensure we not execute too long and so block the processing of other task that are scheduled on theThreadAwareExecutor. This is done by takingIoHandlerContext.delayNanos(long)orIoHandlerContext.deadlineNanos()into account.- Specified by:
runin interfaceIoHandler- Parameters:
context- theIoHandlerContext.- Returns:
- the number of
IoHandlefor which I/O was handled. Internal events such as wakeups and timer expirations must not be included in this count.
-
handleLoopException
Visible only for testing! -
processReady
-
closeFileDescriptors
This method is intended for use by process checkpoint/restore integration, such as OpenJDK CRaC. It's up to the caller to ensure that there is no concurrent use of the FDs while these are closed, e.g. by blocking the executor.
-