Package io.netty.channel.local
Class LocalIoHandler
- java.lang.Object
-
- io.netty.channel.local.LocalIoHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classLocalIoHandler.LocalIoRegistration
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ThreadexecutionThreadprivate ThreadAwareExecutorexecutorprivate java.util.Set<LocalIoHandle>registeredChannels
-
Constructor Summary
Constructors Modifier Constructor Description privateLocalIoHandler(ThreadAwareExecutor executor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static LocalIoHandlecast(IoHandle handle)voiddestroy()Destroy theIoHandlerand free all its resources.booleanisCompatible(java.lang.Class<? extends IoHandle> handleType)Returnstrueif the given type is compatible with thisIoHandlerand so can be registered,falseotherwise.static IoHandlerFactorynewFactory()Returns a newIoHandlerFactorythat createsLocalIoHandlerinstances.voidprepareToDestroy()Prepare to destroy thisIoHandler.IoRegistrationregister(IoHandle handle)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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.IoHandler
initialize
-
-
-
-
Field Detail
-
registeredChannels
private final java.util.Set<LocalIoHandle> registeredChannels
-
executor
private final ThreadAwareExecutor executor
-
executionThread
private volatile java.lang.Thread executionThread
-
-
Constructor Detail
-
LocalIoHandler
private LocalIoHandler(ThreadAwareExecutor executor)
-
-
Method Detail
-
newFactory
public static IoHandlerFactory newFactory()
Returns a newIoHandlerFactorythat createsLocalIoHandlerinstances.
-
cast
private static LocalIoHandle cast(IoHandle handle)
-
run
public int run(IoHandlerContext context)
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.
-
wakeup
public void wakeup()
Description copied from interface:IoHandlerWakeup theIoHandler, which means if any operation blocks it should be unblocked and return as soon as possible.
-
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
public void destroy()
Description copied from interface:IoHandler
-
register
public IoRegistration register(IoHandle handle)
Description copied from interface:IoHandlerRegister aIoHandlefor IO.
-
isCompatible
public boolean isCompatible(java.lang.Class<? extends IoHandle> handleType)
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.
-
-