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
FieldsModifier and TypeFieldDescriptionprivate IoUringRecvByteAllocatorHandleprivate boolean(package private) final WriteOpsSnapshotprivate ChannelPromise(package private) final ChannelOutboundBuffer(package private) java.util.List<ReferenceCounted> private 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, java.lang.Throwable cause, java.nio.channels.ClosedChannelException closeCause) private voidcloseNow()private voidcompleteFastOpenWrite(byte op, int res, int flags, short data) 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.final 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 final voidflush0()private voidfulfillConnectPromise(ChannelPromise promise, boolean wasActive) private voidfulfillConnectPromise(ChannelPromise promise, java.lang.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 processed(package private) final voidprivate 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.(package private) voidreleaseWriteBuffers(java.util.List<ReferenceCounted> buffers, long data) (package private) java.util.List<ReferenceCounted> 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 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) final voidshutdownInput(boolean allDataRead) (package private) final longsubmitWrite(IoUringIoOps ops) 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.private booleanwriteCompleteAndReleaseBuffers(byte op, int res, int flags, long data) 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 java.lang.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
-
currentWrite
-
originalOutboundBuffer
-
retainedWriteBuffers
java.util.List<ReferenceCounted> retainedWriteBuffers
-
-
Constructor Details
-
AbstractUringUnsafe
protected AbstractUringUnsafe()
-
-
Method Details
-
submitWrite
-
prepareToDiscardOutboundMessages
-
retainWriteBuffers
-
releaseWriteBuffers
-
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
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
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
-
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
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.
-
writeCompleteAndReleaseBuffers
private boolean writeCompleteAndReleaseBuffers(byte op, int res, int flags, long data) -
completeFastOpenWrite
private void completeFastOpenWrite(byte op, int res, int flags, short data) -
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
Description copied from interface:Channel.UnsafeDeregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.- Specified by:
deregisterin interfaceChannel.Unsafe- Overrides:
deregisterin classAbstractChannel.AbstractUnsafe
-