Package io.netty.incubator.channel.uring
Class IOUringEventLoop
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- io.netty.util.concurrent.AbstractEventExecutor
-
- io.netty.util.concurrent.AbstractScheduledEventExecutor
-
- io.netty.util.concurrent.SingleThreadEventExecutor
-
- io.netty.channel.SingleThreadEventLoop
-
- io.netty.incubator.channel.uring.IOUringEventLoop
-
- All Implemented Interfaces:
io.netty.channel.EventLoop
,io.netty.channel.EventLoopGroup
,io.netty.util.concurrent.EventExecutor
,io.netty.util.concurrent.EventExecutorGroup
,io.netty.util.concurrent.OrderedEventExecutor
,java.lang.Iterable<io.netty.util.concurrent.EventExecutor>
,java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
,java.util.concurrent.ScheduledExecutorService
public final class IOUringEventLoop extends io.netty.channel.SingleThreadEventLoop
AnEventLoop
that uses IO_URING.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty.channel.SingleThreadEventLoop
io.netty.channel.SingleThreadEventLoop.ChannelsReadOnlyIterator<T extends io.netty.channel.Channel>
-
-
Field Summary
Fields Modifier and Type Field Description private static long
AWAKE
private IOUringCompletionQueueCallback
callback
private io.netty.util.collection.IntObjectMap<AbstractIOUringChannel>
channels
private io.netty.channel.unix.FileDescriptor
eventfd
private long
eventfdReadBuf
private byte[]
inet4AddressArray
private byte[]
inet6AddressArray
private static io.netty.util.internal.logging.InternalLogger
logger
private java.util.concurrent.atomic.AtomicLong
nextWakeupNanos
private static long
NONE
private boolean
pendingWakeup
private long
prevDeadlineNanos
private short
prevTimeoutGeneration
This is a "generation" counter that is passed to addTimeout.private RingBuffer
ringBuffer
private java.lang.Runnable
submitIOTask
-
Constructor Summary
Constructors Constructor Description IOUringEventLoop(IOUringEventLoopGroup parent, java.util.concurrent.Executor executor, int ringSize, int iosqeAsyncThreshold, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler, io.netty.channel.EventLoopTaskQueueFactory queueFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
add(AbstractIOUringChannel ch)
private void
addEventFdRead(IOUringSubmissionQueue submissionQueue)
protected void
cleanup()
private void
closeAll()
(package private) RingBuffer
getRingBuffer()
private void
handle(int fd, int res, int flags, byte op, short data)
private void
handleConnect(AbstractIOUringChannel channel, int res)
(package private) void
handleLoopException(java.lang.Throwable t)
Visible only for testing!private void
handlePollAdd(AbstractIOUringChannel channel, int res, int pollMask)
private void
handleRead(AbstractIOUringChannel channel, int res, int data)
private void
handleWrite(AbstractIOUringChannel channel, int res, int data)
(package private) byte[]
inet4AddressArray()
byte[]
that can be used as temporary storage to encode the ipv4 address(package private) byte[]
inet6AddressArray()
byte[]
that can be used as temporary storage to encode the ipv6 addressprotected java.util.Queue<java.lang.Runnable>
newTaskQueue(int maxPendingTasks)
private static java.util.Queue<java.lang.Runnable>
newTaskQueue(io.netty.channel.EventLoopTaskQueueFactory queueFactory)
private static java.util.Queue<java.lang.Runnable>
newTaskQueue0(int maxPendingTasks)
(package private) void
remove(AbstractIOUringChannel ch)
protected void
run()
void
submitIO()
Submit the IO so the kernel can process it.protected void
wakeup(boolean inEventLoop)
-
Methods inherited from class io.netty.channel.SingleThreadEventLoop
afterRunningAllTasks, executeAfterEventLoopIteration, hasTasks, next, parent, pendingTasks, register, register, register, registeredChannels, registeredChannelsIterator
-
Methods inherited from class io.netty.util.concurrent.SingleThreadEventExecutor
addShutdownHook, addTask, awaitTermination, confirmShutdown, deadlineNanos, delayNanos, execute, inEventLoop, interruptThread, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isShuttingDown, isTerminated, lazyExecute, newTaskQueue, peekTask, pollTask, pollTaskFrom, reject, reject, removeShutdownHook, removeTask, runAllTasks, runAllTasks, runAllTasksFrom, runScheduledAndExecutorTasks, shutdown, shutdownGracefully, takeTask, terminationFuture, threadProperties, updateLastExecutionTime, wakesUpForTask
-
Methods inherited from class io.netty.util.concurrent.AbstractScheduledEventExecutor
afterScheduledTaskSubmitted, beforeScheduledTaskSubmitted, cancelScheduledTasks, deadlineToDelayNanos, getCurrentTimeNanos, hasScheduledTasks, initialNanoTime, nanoTime, nextScheduledTaskDeadlineNanos, nextScheduledTaskNano, pollScheduledTask, pollScheduledTask, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, validateScheduled
-
Methods inherited from class io.netty.util.concurrent.AbstractEventExecutor
inEventLoop, iterator, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, runTask, safeExecute, shutdownGracefully, shutdownNow, submit, submit, submit
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.util.concurrent.EventExecutor
inEventLoop, inEventLoop, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture
-
Methods inherited from interface io.netty.util.concurrent.EventExecutorGroup
isShuttingDown, iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFuture
-
-
-
-
Field Detail
-
logger
private static final io.netty.util.internal.logging.InternalLogger logger
-
eventfdReadBuf
private final long eventfdReadBuf
-
channels
private final io.netty.util.collection.IntObjectMap<AbstractIOUringChannel> channels
-
ringBuffer
private final RingBuffer ringBuffer
-
AWAKE
private static final long AWAKE
- See Also:
- Constant Field Values
-
NONE
private static final long NONE
- See Also:
- Constant Field Values
-
nextWakeupNanos
private final java.util.concurrent.atomic.AtomicLong nextWakeupNanos
-
eventfd
private final io.netty.channel.unix.FileDescriptor eventfd
-
inet4AddressArray
private final byte[] inet4AddressArray
-
inet6AddressArray
private final byte[] inet6AddressArray
-
callback
private final IOUringCompletionQueueCallback callback
-
submitIOTask
private final java.lang.Runnable submitIOTask
-
prevDeadlineNanos
private long prevDeadlineNanos
-
prevTimeoutGeneration
private short prevTimeoutGeneration
This is a "generation" counter that is passed to addTimeout. It ensures that the expiry of a previous timeout doesn't make us think the current timeout has expired, which could lead to wrongly not removing the current timeout when it's adjusted again.
-
pendingWakeup
private boolean pendingWakeup
-
-
Constructor Detail
-
IOUringEventLoop
IOUringEventLoop(IOUringEventLoopGroup parent, java.util.concurrent.Executor executor, int ringSize, int iosqeAsyncThreshold, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler, io.netty.channel.EventLoopTaskQueueFactory queueFactory)
-
-
Method Detail
-
submitIO
public void submitIO()
Submit the IO so the kernel can process it. This method can be called to "force" the submission (before it is submitted by netty itself).
-
newTaskQueue
private static java.util.Queue<java.lang.Runnable> newTaskQueue(io.netty.channel.EventLoopTaskQueueFactory queueFactory)
-
newTaskQueue
protected java.util.Queue<java.lang.Runnable> newTaskQueue(int maxPendingTasks)
- Overrides:
newTaskQueue
in classio.netty.util.concurrent.SingleThreadEventExecutor
-
newTaskQueue0
private static java.util.Queue<java.lang.Runnable> newTaskQueue0(int maxPendingTasks)
-
add
void add(AbstractIOUringChannel ch)
-
remove
void remove(AbstractIOUringChannel ch)
-
closeAll
private void closeAll()
-
run
protected void run()
- Specified by:
run
in classio.netty.util.concurrent.SingleThreadEventExecutor
-
handleLoopException
void handleLoopException(java.lang.Throwable t)
Visible only for testing!
-
handle
private void handle(int fd, int res, int flags, byte op, short data)
-
handleRead
private void handleRead(AbstractIOUringChannel channel, int res, int data)
-
handleWrite
private void handleWrite(AbstractIOUringChannel channel, int res, int data)
-
handlePollAdd
private void handlePollAdd(AbstractIOUringChannel channel, int res, int pollMask)
-
addEventFdRead
private void addEventFdRead(IOUringSubmissionQueue submissionQueue)
-
handleConnect
private void handleConnect(AbstractIOUringChannel channel, int res)
-
cleanup
protected void cleanup()
- Overrides:
cleanup
in classio.netty.util.concurrent.SingleThreadEventExecutor
-
getRingBuffer
RingBuffer getRingBuffer()
-
wakeup
protected void wakeup(boolean inEventLoop)
- Overrides:
wakeup
in classio.netty.util.concurrent.SingleThreadEventExecutor
-
inet4AddressArray
byte[] inet4AddressArray()
byte[]
that can be used as temporary storage to encode the ipv4 address
-
inet6AddressArray
byte[] inet6AddressArray()
byte[]
that can be used as temporary storage to encode the ipv6 address
-
-