Class AbstractIoUringChannel.AbstractUringUnsafe
java.lang.Object
io.netty.channel.AbstractChannel.AbstractUnsafe
io.netty.channel.uring.AbstractIoUringChannel.AbstractUringUnsafe
- All Implemented Interfaces:
Channel.Unsafe, IoHandle, IoUringIoHandle, 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
FieldsModifier and TypeFieldDescriptionprivate IoUringRecvByteAllocatorHandleprivate booleanprivate ChannelPromiseprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidcancelComplete0(byte op, int res, int flags, short data) Called once a cancel was completed.private booleancancelOps(boolean cancelConnect) private booleanprotected booleanfinal voidclose()Called once theIoHandleshould be closed.protected voidclose(ChannelPromise promise, Throwable cause, ClosedChannelException closeCause) private voidcloseNow()voidconnect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) (package private) voidconnectComplete(byte op, int res, int flags, long data) Called once a connect was completed.final voidderegister(ChannelPromise promise) Deregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.private voidfillTFOInitData(MsgHdrMemory hdr, InetSocketAddress inetSocketAddress, ByteBuf initialData) private voidfireEventAndClose(Object evt) protected final voidflush0()private voidfulfillConnectPromise(ChannelPromise promise, boolean wasActive) private voidfulfillConnectPromise(ChannelPromise promise, Throwable cause) final voidhandle(IoRegistration registration, IoEvent ioEvent) Be called once there is something to handle.private voidprotected final booleanprivate 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.Return the assignedRecvByteBufAllocator.Handlewhich will be used to allocateByteBuf's when receiving data.private voidprivate void(package private) final voidprotected final 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 intSchedule 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 intSchedule 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) final voidshutdownInput(boolean allDataRead) voidCalled 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 AbstractChannel.AbstractUnsafe
annotateConnectException, beginRead, bind, close, closeForcibly, closeIfClosed, disconnect, ensureOpen, flush, handleWriteError, localAddress, outboundBuffer, prepareToClose, register, remoteAddress, safeSetFailure, safeSetSuccess, shutdownOutput, voidPromise, writeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IoHandle
registered
-
Field Details
-
allocHandle
-
closed
private boolean closed -
socketIsEmpty
private boolean socketIsEmpty -
deregisterPromise
-
-
Constructor Details
-
AbstractUringUnsafe
protected AbstractUringUnsafe()
-
-
Method Details
-
scheduleWriteMultiple
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
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
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
Description 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.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIoHandle- Throws:
Exception
-
close
- 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
-
fulfillConnectPromise
-
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
-
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(SocketAddress remoteAddress, 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, InetSocketAddress inetSocketAddress, ByteBuf initialData) throws Exception - Throws:
Exception
-
deregister
Description copied from interface:Channel.UnsafeDeregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.- Specified by:
deregisterin interfaceChannel.Unsafe- Overrides:
deregisterin classAbstractChannel.AbstractUnsafe
-