Package io.netty.channel.uring
Class IoUringIoHandler
- java.lang.Object
-
- io.netty.channel.uring.IoUringIoHandler
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroy theIoHandler
and free all its resources.void
initialize()
Initialize thisIoHandler
.boolean
isCompatible(java.lang.Class<? extends IoHandle> handleType)
Returnstrue
if the given type is compatible with thisIoHandler
and so can be registered,false
otherwise.static IoHandlerFactory
newFactory()
Create a newIoHandlerFactory
that can be used to createIoUringIoHandler
s.static IoHandlerFactory
newFactory(int ringSize)
Create a newIoHandlerFactory
that can be used to createIoUringIoHandler
s.static IoHandlerFactory
newFactory(IoUringIoHandlerConfig config)
Create a newIoHandlerFactory
that can be used to createIoUringIoHandler
s.void
prepareToDestroy()
Prepare to destroy thisIoHandler
.IoRegistration
register(IoHandle handle)
Register aIoHandle
for IO.int
run(IoHandlerContext context)
Run the IO handled by thisIoHandler
.void
wakeup()
Wakeup theIoHandler
, which means if any operation blocks it should be unblocked and return as soon as possible.
-
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:IoHandler
Initialize thisIoHandler
.- Specified by:
initialize
in interfaceIoHandler
-
run
public int run(IoHandlerContext context)
Description copied from interface:IoHandler
Run the IO handled by thisIoHandler
. TheIoHandlerContext
should 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:
run
in interfaceIoHandler
- Parameters:
context
- theIoHandlerContext
.- Returns:
- the number of
IoHandle
for which I/O was handled.
-
prepareToDestroy
public void prepareToDestroy()
Description copied from interface:IoHandler
Prepare to destroy thisIoHandler
. This method will be called beforeIoHandler.destroy()
and may be called multiple times.- Specified by:
prepareToDestroy
in interfaceIoHandler
-
destroy
public void destroy()
Description copied from interface:IoHandler
-
register
public IoRegistration register(IoHandle handle) throws java.lang.Exception
Description copied from interface:IoHandler
Register aIoHandle
for IO.
-
wakeup
public void wakeup()
Description copied from interface:IoHandler
Wakeup theIoHandler
, which means if any operation blocks it should be unblocked and return as soon as possible.
-
isCompatible
public boolean isCompatible(java.lang.Class<? extends IoHandle> handleType)
Description copied from interface:IoHandler
Returnstrue
if the given type is compatible with thisIoHandler
and so can be registered,false
otherwise.- Specified by:
isCompatible
in interfaceIoHandler
- Parameters:
handleType
- the type of theIoHandle
.- Returns:
- if compatible of not.
-
newFactory
public static IoHandlerFactory newFactory()
Create a newIoHandlerFactory
that can be used to createIoUringIoHandler
s.- Returns:
- factory
-
newFactory
public static IoHandlerFactory newFactory(int ringSize)
Create a newIoHandlerFactory
that can be used to createIoUringIoHandler
s. EachIoUringIoHandler
will use a ring of sizeringSize
.- Parameters:
ringSize
- the size of the ring.- Returns:
- factory
-
newFactory
public static IoHandlerFactory newFactory(IoUringIoHandlerConfig config)
Create a newIoHandlerFactory
that can be used to createIoUringIoHandler
s. EachIoUringIoHandler
will use same option- Parameters:
config
- the io_uring configuration- Returns:
- factory
-
-