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, java.lang.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 java.util.concurrent.ScheduledFuture<?> private longprivate java.lang.Objectprivate ChannelOutboundBufferprivate booleanprivate booleanprivate byteprivate java.net.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 java.net.SocketAddressprivate java.nio.ByteBufferprivate java.net.SocketAddress(package private) final LinuxSocketprivate booleanprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionAbstractIoUringChannel(Channel parent, LinuxSocket socket, boolean active) AbstractIoUringChannel(Channel parent, LinuxSocket fd, java.net.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 voidcheckResolvable(java.net.InetSocketAddress addr) private voidprivate voidprotected final voidSchedule a read operation.private voidprotected voiddoBind(java.net.SocketAddress local) Bind theChannelto theSocketAddressprotected voiddoClose()Close theChannelprotected final voidprotected voidDisconnect thisChannelfrom its remote peerprotected voiddoRegister(ChannelPromise promise) protected final voidCalled when conditions justify shutting down the output portion of the channel.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 java.lang.ObjectfilterOutboundMessage(java.lang.Object msg) Invoked 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 java.net.SocketAddressReturns theSocketAddresswhich is bound locally.private static shortnarrowUserData(long userData) protected final ByteBufnewDirectBuffer(ByteBuf buf) protected final ByteBufnewDirectBuffer(java.lang.Object holder, ByteBuf buf) private static ByteBufnewDirectBuffer0(java.lang.Object holder, ByteBuf buf, ByteBufAllocator alloc, int capacity) protected final shortReturns the next id that should be used when submittingIoUringIoOps.protected final IoRegistrationprotected final java.net.SocketAddressReturn theSocketAddresswhich theChannelis connected to.private voidRemoves the bytes that were sent by a TCP_FASTOPEN_CONNECT from theChannelOutboundBufferif the channel was connected, and forgets about them otherwise.(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(java.net.InetSocketAddress inetSocketAddress) (package private) final MsgHdrMemoryMethods 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 class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 java.lang.Comparable
compareTo
-
Field Details
-
logger
-
socket
-
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
private java.util.concurrent.ScheduledFuture<?> connectTimeoutFuture -
requestedRemoteAddress
private java.net.SocketAddress requestedRemoteAddress -
cleanable
-
remoteAddressMemory
private java.nio.ByteBuffer remoteAddressMemory -
msgHdrMemoryArray
-
fastOpenOutboundBuffer
-
fastOpenData
private java.lang.Object fastOpenData -
fastOpenBytes
private long fastOpenBytes -
registration
-
local
private volatile java.net.SocketAddress local -
remote
private volatile java.net.SocketAddress remote
-
-
Constructor Details
-
AbstractIoUringChannel
AbstractIoUringChannel(Channel parent, LinuxSocket socket, boolean active) -
AbstractIoUringChannel
AbstractIoUringChannel(Channel parent, LinuxSocket fd, java.net.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(java.lang.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
protected void doDisconnect() throws java.lang.ExceptionDescription copied from class:AbstractChannelDisconnect thisChannelfrom its remote peer- Specified by:
doDisconnectin classAbstractChannel- Throws:
java.lang.Exception
-
freeRemoteAddressMemory
private void freeRemoteAddressMemory() -
writeMsgHdr
-
freeMsgHdrArray
private void freeMsgHdrArray() -
doClose
protected void doClose() throws java.lang.ExceptionDescription copied from class:AbstractChannelClose theChannel- Specified by:
doClosein classAbstractChannel- Throws:
java.lang.Exception
-
doShutdownOutput
protected final void doShutdownOutput() throws java.lang.ExceptionDescription copied from class:AbstractChannelCalled when conditions justify shutting down the output portion of the channel. This may happen if a write operation throws an exception.- Overrides:
doShutdownOutputin classAbstractChannel- Throws:
java.lang.Exception
-
removeFastOpenData
private void removeFastOpenData()Removes the bytes that were sent by a TCP_FASTOPEN_CONNECT from theChannelOutboundBufferif the channel was connected, and forgets about them otherwise. Must be called before theChannelOutboundBufferis written or its messages are failed. -
doShutdownOutput0
protected void doShutdownOutput0() throws java.lang.ExceptionPerforms the actual output shutdown. Overridden by subclasses that support it.- Throws:
java.lang.Exception
-
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
private void submitConnect(java.net.InetSocketAddress inetSocketAddress) -
submitConnect
-
filterOutboundMessage
protected java.lang.Object filterOutboundMessage(java.lang.Object msg) 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
protected void doBind(java.net.SocketAddress local) throws java.lang.Exception Description copied from class:AbstractChannelBind theChannelto theSocketAddress- Specified by:
doBindin classAbstractChannel- Throws:
java.lang.Exception
-
checkResolvable
protected static void checkResolvable(java.net.InetSocketAddress addr) -
localAddress0
protected final java.net.SocketAddress localAddress0()Description copied from class:AbstractChannelReturns theSocketAddresswhich is bound locally.- Specified by:
localAddress0in classAbstractChannel
-
remoteAddress0
protected final java.net.SocketAddress 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()
-