Class AbstractIoUringChannel
java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
io.netty.channel.uring.AbstractIoUringChannel
- All Implemented Interfaces:
Channel, ChannelOutboundInvoker, UnixChannel, AttributeMap, Comparable<Channel>
- Direct Known Subclasses:
AbstractIoUringServerChannel, AbstractIoUringStreamChannel, IoUringDatagramChannel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprivate static final classNested classes/interfaces inherited from class AbstractChannel
AbstractChannel.AbstractUnsafeNested classes/interfaces inherited from interface Channel
Channel.Unsafe -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprivate CleanableDirectBufferprivate static final intprivate longprivate ChannelPromiseThe future of the current connection attempt.private ScheduledFuture<?> private booleanprivate booleanprivate byteprivate SocketAddressprivate static final InternalLoggerprivate MsgHdrMemoryArrayprivate shortprivate shortprivate shortprivate static final intprivate static final intprivate static final intprivate longprivate longprivate longprivate static final intprivate booleanprivate IoRegistrationprivate SocketAddressprivate ByteBufferprivate SocketAddress(package private) final LinuxSocketprivate booleanprivate static final int(package private) final WriteOperationTracker -
Constructor Summary
ConstructorsConstructorDescriptionAbstractIoUringChannel(Channel parent, LinuxSocket socket, boolean active) AbstractIoUringChannel(Channel parent, LinuxSocket fd, SocketAddress remote) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean(package private) final voidprivate voidprotected abstract voidcancelOutstandingReads(IoRegistration registration, int numOutstandingReads) Cancel all outstanding readsprotected abstract voidcancelOutstandingWrites(IoRegistration registration, int numOutstandingWrites) Cancel all outstanding writesprotected static voidprivate voidprivate voidprotected final voidSchedule a read operation.private voidprotected voiddoBind(SocketAddress local) Bind theChannelto theSocketAddressprotected voiddoClose()Close theChannelprotected final voidprotected voidDisconnect thisChannelfrom its remote peerprotected voiddoRegister(ChannelPromise promise) protected final voidRetains every in-flight write's references before handing off todoShutdownOutput0(), so a write completion that races the shutdown still finds a live reference to release instead of one the outbound buffer already dropped.protected voidPerforms the actual output shutdown.protected voidFlush the content of the given buffer to the remote peer.final FileDescriptorfd()Returns theFileDescriptorthat is used by thisChannel.protected ObjectInvoked when a new message is added to aChannelOutboundBufferof thisAbstractChannel, so that theChannelimplementation converts the message to another.private voidprivate voidbooleanisActive()Returntrueif theChannelis active and so connected.private static booleanisAllowHalfClosure(ChannelConfig config) protected booleanisCompatible(EventLoop loop) Returntrueif the givenEventLoopis compatible with this instance.final booleanisOpen()Returnstrueif theChannelis open and may get active later(package private) abstract booleanprotected abstract booleanprotected final SocketAddressReturns theSocketAddresswhich is bound locally.private static shortnarrowUserData(long userData) protected final ByteBufnewDirectBuffer(ByteBuf buf) protected final ByteBufnewDirectBuffer(Object holder, ByteBuf buf) private static ByteBufnewDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity) protected final shortReturns the next id that should be used when submittingIoUringIoOps.protected final IoRegistrationprotected final SocketAddressReturn theSocketAddresswhich theChannelis connected to.(package private) final voidprivate longschedulePollAdd(int ioMask, int mask, boolean multishot) private void(package private) final voidprivate intprotected voidscheduleWriteIfNeeded(ChannelOutboundBuffer in, boolean submitAndRunNow) private booleanprotected abstract booleansocketIsEmpty(int flags) Return if the socket is guaranteed to be empty when the submitted io was executed and the completion event be created.protected voidprivate voidsubmitConnect(DomainSocketAddress unixDomainSocketAddress) private voidsubmitConnect(InetSocketAddress inetSocketAddress) Methods inherited from class AbstractChannel
closeFuture, compareTo, doRegister, equals, eventLoop, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, localAddress, maxMessagesPerWrite, newChannelPipeline, newId, newUnsafe, parent, pipeline, remoteAddress, toString, unsafe, validateFileRegion, voidPromiseMethods inherited from class DefaultAttributeMap
attr, hasAttrMethods inherited from interface AttributeMap
attr, hasAttrMethods inherited from interface Channel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, config, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, eventLoop, flush, getOption, id, isRegistered, isWritable, localAddress, metadata, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, setOption, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlushMethods inherited from interface Comparable
compareTo
-
Field Details
-
logger
-
socket
-
writeTracker
-
active
protected volatile boolean active -
POLL_IN_SCHEDULED
private static final int POLL_IN_SCHEDULED- See Also:
-
POLL_OUT_SCHEDULED
private static final int POLL_OUT_SCHEDULED- See Also:
-
POLL_RDHUP_SCHEDULED
private static final int POLL_RDHUP_SCHEDULED- See Also:
-
WRITE_SCHEDULED
private static final int WRITE_SCHEDULED- See Also:
-
READ_SCHEDULED
private static final int READ_SCHEDULED- See Also:
-
CONNECT_SCHEDULED
private static final int CONNECT_SCHEDULED- See Also:
-
opsId
private short opsId -
pollInId
private long pollInId -
pollOutId
private long pollOutId -
pollRdhupId
private long pollRdhupId -
connectId
private long connectId -
ioState
private byte ioState -
numOutstandingWrites
private short numOutstandingWrites -
numOutstandingReads
private short numOutstandingReads -
readPending
private boolean readPending -
inReadComplete
private boolean inReadComplete -
socketHasMoreData
private boolean socketHasMoreData -
delayedClose
-
inputClosedSeenErrorOnRead
private boolean inputClosedSeenErrorOnRead -
connectPromise
The future of the current connection attempt. If not null, subsequent connection attempts will fail. -
connectTimeoutFuture
-
requestedRemoteAddress
-
cleanable
-
remoteAddressMemory
-
msgHdrMemoryArray
-
registration
-
local
-
remote
-
-
Constructor Details
-
AbstractIoUringChannel
AbstractIoUringChannel(Channel parent, LinuxSocket socket, boolean active) -
AbstractIoUringChannel
AbstractIoUringChannel(Channel parent, LinuxSocket fd, SocketAddress remote)
-
-
Method Details
-
autoReadCleared
final void autoReadCleared() -
clearRead
private void clearRead() -
nextOpsId
protected final short nextOpsId()Returns the next id that should be used when submittingIoUringIoOps.- Returns:
- opsId
-
isOpen
-
isActive
-
fd
Description copied from interface:UnixChannelReturns theFileDescriptorthat is used by thisChannel.- Specified by:
fdin interfaceUnixChannel
-
ioUringUnsafe
-
isCompatible
Description copied from class:AbstractChannelReturntrueif the givenEventLoopis compatible with this instance.- Specified by:
isCompatiblein classAbstractChannel
-
newDirectBuffer
-
allowMultiShotPollIn
protected boolean allowMultiShotPollIn() -
newDirectBuffer
-
newDirectBuffer0
private static ByteBuf newDirectBuffer0(Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity) -
cancelOutstandingReads
protected abstract void cancelOutstandingReads(IoRegistration registration, int numOutstandingReads) Cancel all outstanding reads- Parameters:
registration- theIoRegistration.numOutstandingReads- the number of outstanding reads, or-1if multi-shot was used.
-
cancelOutstandingWrites
protected abstract void cancelOutstandingWrites(IoRegistration registration, int numOutstandingWrites) Cancel all outstanding writes- Parameters:
registration- theIoRegistration.numOutstandingWrites- the number of outstanding writes.
-
doDisconnect
Description copied from class:AbstractChannelDisconnect thisChannelfrom its remote peer- Specified by:
doDisconnectin classAbstractChannel- Throws:
Exception
-
freeRemoteAddressMemory
private void freeRemoteAddressMemory() -
freeMsgHdrArray
private void freeMsgHdrArray() -
doClose
Description copied from class:AbstractChannelClose theChannel- Specified by:
doClosein classAbstractChannel- Throws:
Exception
-
doShutdownOutput
Retains every in-flight write's references before handing off todoShutdownOutput0(), so a write completion that races the shutdown still finds a live reference to release instead of one the outbound buffer already dropped.- Overrides:
doShutdownOutputin classAbstractChannel- Throws:
Exception
-
doShutdownOutput0
-
doBeginRead
protected final void doBeginRead()Description copied from class:AbstractChannelSchedule a read operation.- Specified by:
doBeginReadin classAbstractChannel
-
doBeginReadNow
private void doBeginReadNow() -
doWrite
Description copied from class:AbstractChannelFlush the content of the given buffer to the remote peer.- Specified by:
doWritein classAbstractChannel
-
scheduleWriteIfNeeded
-
submitAndRunNow
protected void submitAndRunNow() -
scheduleWrite
-
registration
-
schedulePollOut
private void schedulePollOut() -
schedulePollRdHup
final void schedulePollRdHup() -
isStreamSocket
protected abstract boolean isStreamSocket() -
schedulePollAdd
private long schedulePollAdd(int ioMask, int mask, boolean multishot) -
resetCachedAddresses
final void resetCachedAddresses() -
narrowUserData
private static short narrowUserData(long userData) -
submitConnect
-
submitConnect
-
filterOutboundMessage
Description copied from class:AbstractChannelInvoked when a new message is added to aChannelOutboundBufferof thisAbstractChannel, so that theChannelimplementation converts the message to another. (e.g. heap buffer -> direct buffer)- Overrides:
filterOutboundMessagein classAbstractChannel
-
doRegister
Description copied from class:AbstractChannelIs called after theChannelis registered with itsEventLoopas part of the register process. Subclasses may override this method- Overrides:
doRegisterin classAbstractChannel- Parameters:
promise-ChannelPromisethat must be notified once done to continue the registration.
-
doDeregister
protected final void doDeregister()Description copied from class:AbstractChannel- Overrides:
doDeregisterin classAbstractChannel
-
doBind
Description copied from class:AbstractChannelBind theChannelto theSocketAddress- Specified by:
doBindin classAbstractChannel- Throws:
Exception
-
checkResolvable
-
localAddress0
Description copied from class:AbstractChannelReturns theSocketAddresswhich is bound locally.- Specified by:
localAddress0in classAbstractChannel
-
remoteAddress0
Description copied from class:AbstractChannelReturn theSocketAddresswhich theChannelis connected to.- Specified by:
remoteAddress0in classAbstractChannel
-
isAllowHalfClosure
-
cancelConnectTimeoutFuture
private void cancelConnectTimeoutFuture() -
computeRemote
private void computeRemote() -
shouldBreakIoUringInReady
-
socketIsEmpty
protected abstract boolean socketIsEmpty(int flags) Return if the socket is guaranteed to be empty when the submitted io was executed and the completion event be created.- Parameters:
flags- the flags that were part of the completion- Returns:
trueif empty.
-
isPollInFirst
abstract boolean isPollInFirst()
-