Package io.netty.channel.uring
Class AbstractIoUringChannel.AbstractUringUnsafe
- java.lang.Object
-
- io.netty.channel.AbstractChannel.AbstractUnsafe
-
- io.netty.channel.uring.AbstractIoUringChannel.AbstractUringUnsafe
-
- All Implemented Interfaces:
Channel.Unsafe,IoHandle,IoUringIoHandle,java.lang.AutoCloseable
- Direct Known Subclasses:
AbstractIoUringServerChannel.UringServerChannelUnsafe,AbstractIoUringStreamChannel.IoUringStreamUnsafe,IoUringDatagramChannel.IoUringDatagramChannelUnsafe
- Enclosing class:
- AbstractIoUringChannel
protected abstract class AbstractIoUringChannel.AbstractUringUnsafe extends AbstractChannel.AbstractUnsafe implements IoUringIoHandle
-
-
Field Summary
Fields Modifier and Type Field Description private IoUringRecvByteAllocatorHandleallocHandleprivate booleanclosedprivate ChannelPromisederegisterPromiseprivate booleansocketIsEmpty
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractUringUnsafe()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) voidcancelComplete0(byte op, int res, int flags, short data)Called once a cancel was completed.private booleancancelOps(boolean cancelConnect)private booleancanCloseNow()protected booleancanCloseNow0()voidclose()Called once theIoHandleshould be closed.protected voidclose(ChannelPromise promise, java.lang.Throwable cause, java.nio.channels.ClosedChannelException closeCause)private voidcloseNow()voidconnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)(package private) voidconnectComplete(byte op, int res, int flags, long data)Called once a connect was completed.voidderegister(ChannelPromise promise)Deregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.private voidfillTFOInitData(MsgHdrMemory hdr, java.net.InetSocketAddress inetSocketAddress, ByteBuf initialData)private voidfireEventAndClose(java.lang.Object evt)protected voidflush0()private voidfulfillConnectPromise(ChannelPromise promise, boolean wasActive)private voidfulfillConnectPromise(ChannelPromise promise, java.lang.Throwable cause)voidhandle(IoRegistration registration, IoEvent ioEvent)Be called once there is something to handle.private voidhandleDelayedClosed()protected booleanisReadMultishot()private voidpollAddComplete(int res, int flags, short data)private voidpollIn(int res, int flags, short data)Called once POLLIN event is ready to be processedprivate voidpollOut(int res)Called once POLLOUT event is ready to be processedprivate voidpollRdHup(int res)Called once POLLRDHUP event is ready to be processedprivate voidreadComplete(byte op, int res, int flags, short data)protected abstract voidreadComplete0(byte op, int res, int flags, short data, int outstandingCompletes)Called once a read was completed.IoUringRecvByteAllocatorHandlerecvBufAllocHandle()Return the assignedRecvByteBufAllocator.Handlewhich will be used to allocateByteBuf's when receiving data.private voidscheduleFirstRead()private voidscheduleFirstReadIfNeeded()(package private) voidschedulePollIn()protected voidscheduleRead(boolean first)protected abstract intscheduleRead0(boolean first, boolean socketIsEmpty)Schedule a read and returns the number ofreadComplete(byte, int, int, short)calls that are expected because of the scheduled read.protected abstract intscheduleWriteMultiple(ChannelOutboundBuffer in)Schedule the write of multiple messages in theChannelOutboundBufferand returns the number ofwriteComplete(byte, int, int, long)calls that are expected because of the scheduled write.protected abstract intscheduleWriteSingle(java.lang.Object msg)Schedule the write of a single message and returns the number ofwriteComplete(byte, int, int, long)calls that are expected because of the scheduled write.(package private) voidshutdownInput(boolean allDataRead)voidunregistered()Called once thisIoHandlewas unregistered and so will not receive any more events viaIoHandle.handle(IoRegistration, IoEvent).private voidwriteComplete(byte op, int res, int flags, long data)Called once a write was completed.(package private) abstract booleanwriteComplete0(byte op, int res, int flags, long data, int outstanding)Called once a write was completed.-
Methods inherited from class io.netty.channel.AbstractChannel.AbstractUnsafe
annotateConnectException, beginRead, bind, close, closeForcibly, closeIfClosed, disconnect, ensureOpen, flush, handleWriteError, localAddress, outboundBuffer, prepareToClose, register, remoteAddress, safeSetFailure, safeSetSuccess, shutdownOutput, voidPromise, write
-
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.IoHandle
registered
-
-
-
-
Field Detail
-
allocHandle
private IoUringRecvByteAllocatorHandle allocHandle
-
closed
private boolean closed
-
socketIsEmpty
private boolean socketIsEmpty
-
deregisterPromise
private ChannelPromise deregisterPromise
-
-
Method Detail
-
scheduleWriteMultiple
protected abstract int scheduleWriteMultiple(ChannelOutboundBuffer in)
Schedule the write of multiple messages in theChannelOutboundBufferand returns the number ofwriteComplete(byte, int, int, long)calls that are expected because of the scheduled write.
-
scheduleWriteSingle
protected abstract int scheduleWriteSingle(java.lang.Object msg)
Schedule the write of a single message and returns the number ofwriteComplete(byte, int, int, long)calls that are expected because of the scheduled write.
-
handle
public final void handle(IoRegistration registration, IoEvent ioEvent)
Description copied from interface:IoHandleBe called once there is something to handle.
-
unregistered
public void unregistered()
Description copied from interface:IoHandleCalled once thisIoHandlewas unregistered and so will not receive any more events viaIoHandle.handle(IoRegistration, IoEvent).- Specified by:
unregisteredin interfaceIoHandle
-
handleDelayedClosed
private void handleDelayedClosed()
-
pollAddComplete
private void pollAddComplete(int res, int flags, short data)
-
close
public final void close() throws java.lang.ExceptionDescription copied from interface:IoHandleCalled once theIoHandleshould be closed. Even once this method is called this handle might still receive events viaIoHandle.handle(IoRegistration, IoEvent)(if it was previous be registered and so itsIoHandle.registered()method was called) until theIoHandle.unregistered()method is called.
-
close
protected void close(ChannelPromise promise, java.lang.Throwable cause, java.nio.channels.ClosedChannelException closeCause)
- Overrides:
closein classAbstractChannel.AbstractUnsafe
-
cancelOps
private boolean cancelOps(boolean cancelConnect)
-
canCloseNow
private boolean canCloseNow()
-
canCloseNow0
protected boolean canCloseNow0()
-
closeNow
private void closeNow()
-
flush0
protected final void flush0()
- Overrides:
flush0in classAbstractChannel.AbstractUnsafe
-
fulfillConnectPromise
private void fulfillConnectPromise(ChannelPromise promise, java.lang.Throwable cause)
-
fulfillConnectPromise
private void fulfillConnectPromise(ChannelPromise promise, boolean wasActive)
-
recvBufAllocHandle
public final IoUringRecvByteAllocatorHandle recvBufAllocHandle()
Description copied from interface:Channel.UnsafeReturn the assignedRecvByteBufAllocator.Handlewhich will be used to allocateByteBuf's when receiving data.- Specified by:
recvBufAllocHandlein interfaceChannel.Unsafe- Overrides:
recvBufAllocHandlein classAbstractChannel.AbstractUnsafe
-
shutdownInput
final void shutdownInput(boolean allDataRead)
-
fireEventAndClose
private void fireEventAndClose(java.lang.Object evt)
-
schedulePollIn
final void schedulePollIn()
-
isReadMultishot
protected final boolean isReadMultishot()
-
readComplete
private void readComplete(byte op, int res, int flags, short data)
-
readComplete0
protected abstract void readComplete0(byte op, int res, int flags, short data, int outstandingCompletes)Called once a read was completed.
-
pollRdHup
private void pollRdHup(int res)
Called once POLLRDHUP event is ready to be processed
-
pollIn
private void pollIn(int res, int flags, short data)Called once POLLIN event is ready to be processed
-
scheduleFirstReadIfNeeded
private void scheduleFirstReadIfNeeded()
-
scheduleFirstRead
private void scheduleFirstRead()
-
scheduleRead
protected final void scheduleRead(boolean first)
-
scheduleRead0
protected abstract int scheduleRead0(boolean first, boolean socketIsEmpty)Schedule a read and returns the number ofreadComplete(byte, int, int, short)calls that are expected because of the scheduled read.- Parameters:
first-trueif this is the first read of a read loop.socketIsEmpty-trueif the socket is guaranteed to be empty,falseotherwise.- Returns:
- the number of
readComplete(byte, int, int, short)calls expected or-1ifreadComplete(byte, int, int, short)is called until the read is cancelled (multi-shot).
-
pollOut
private void pollOut(int res)
Called once POLLOUT event is ready to be processed- Parameters:
res- the result.
-
writeComplete
private void writeComplete(byte op, int res, int flags, long data)Called once a write was completed.- Parameters:
op- the op code.res- the result.flags- the flags.data- the data that was passed when submitting the op.
-
writeComplete0
abstract boolean writeComplete0(byte op, int res, int flags, long data, int outstanding)Called once a write was completed.- Parameters:
op- the op coderes- the result.flags- the flags.data- the data that was passed when submitting the op.outstanding- the outstanding write completions.
-
cancelComplete0
void cancelComplete0(byte op, int res, int flags, short data)Called once a cancel was completed.- Parameters:
op- the op coderes- the result.flags- the flags.data- the data that was passed when submitting the op.
-
connectComplete
void connectComplete(byte op, int res, int flags, long data)Called once a connect was completed.- Parameters:
op- the op code.res- the result.flags- the flags.data- the data that was passed when submitting the op.
-
connect
public void connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)Description copied from interface:Channel.UnsafeConnect theChannelof the givenChannelFuturewith the given remoteSocketAddress. If a specific localSocketAddressshould be used it need to be given as argument. Otherwise just passnullto it. TheChannelPromisewill get notified once the connect operation was complete.- Specified by:
connectin interfaceChannel.Unsafe
-
fillTFOInitData
private void fillTFOInitData(MsgHdrMemory hdr, java.net.InetSocketAddress inetSocketAddress, ByteBuf initialData) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deregister
public final void deregister(ChannelPromise promise)
Description copied from interface:Channel.UnsafeDeregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.- Specified by:
deregisterin interfaceChannel.Unsafe- Overrides:
deregisterin classAbstractChannel.AbstractUnsafe
-
-