Package io.netty.channel.uring
Class AbstractIoUringStreamChannel
- java.lang.Object
-
- io.netty.util.DefaultAttributeMap
-
- io.netty.channel.AbstractChannel
-
- io.netty.channel.uring.AbstractIoUringChannel
-
- io.netty.channel.uring.AbstractIoUringStreamChannel
-
- All Implemented Interfaces:
Channel,ChannelOutboundInvoker,DuplexChannel,UnixChannel,AttributeMap,java.lang.Comparable<Channel>
- Direct Known Subclasses:
IoUringDomainSocketChannel,IoUringSocketChannel
abstract class AbstractIoUringStreamChannel extends AbstractIoUringChannel implements DuplexChannel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAbstractIoUringStreamChannel.ByteBufWritableByteChannelAWritableByteChannelbacked by aByteBuf.protected classAbstractIoUringStreamChannel.IoUringStreamUnsafe-
Nested classes/interfaces inherited from class io.netty.channel.uring.AbstractIoUringChannel
AbstractIoUringChannel.AbstractUringUnsafe
-
Nested classes/interfaces inherited from class io.netty.channel.AbstractChannel
AbstractChannel.AbstractUnsafe
-
Nested classes/interfaces inherited from interface io.netty.channel.Channel
Channel.Unsafe
-
-
Field Summary
Fields Modifier and Type Field Description private IoUringBufferRingbufferRingprivate static intFILE_REGION_MAX_CHUNK_SIZEMaximum bytes per chunk when converting a genericFileRegionto aByteBuffor the io_uring async send path.private static InternalLoggerloggerprivate static ChannelMetadataMETADATA(package private) longreadId(package private) bytereadOpCode(package private) longwriteId(package private) bytewriteOpCode-
Fields inherited from class io.netty.channel.uring.AbstractIoUringChannel
active, socket, writeTracker
-
-
Constructor Summary
Constructors Constructor Description AbstractIoUringStreamChannel(Channel parent, LinuxSocket socket, boolean active)AbstractIoUringStreamChannel(Channel parent, LinuxSocket socket, java.net.SocketAddress remote)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcancelOutstandingReads(IoRegistration registration, int numOutstandingReads)Cancel all outstanding readsprotected voidcancelOutstandingWrites(IoRegistration registration, int numOutstandingWrites)Cancel all outstanding writesprotected voiddoRegister(ChannelPromise promise)protected voiddoShutdownOutput0()Performs the actual output shutdown.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.booleanisInputShutdown()Returnstrueif and only if the remote peer shut down its output so that no more data is received from this channel.booleanisOutputShutdown()(package private) booleanisPollInFirst()booleanisShutdown()Determine if both the input and output of this channel have been shutdown.protected booleanisStreamSocket()ChannelMetadatametadata()protected AbstractIoUringChannel.AbstractUringUnsafenewUnsafe()Create a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannelprotected booleanshouldCompleteReadLoop(int flags, boolean multishot)ChannelFutureshutdown()Will shutdown the input and output sides of this channel.ChannelFutureshutdown(ChannelPromise promise)Will shutdown the input and output sides of this channel.private static voidshutdownDone(ChannelFuture shutdownOutputFuture, ChannelFuture shutdownInputFuture, ChannelPromise promise)ChannelFutureshutdownInput()ChannelFutureshutdownInput(ChannelPromise promise)Will shutdown the input and notifyChannelPromise.private voidshutdownInput0(ChannelPromise promise)ChannelFutureshutdownOutput()ChannelFutureshutdownOutput(ChannelPromise promise)Will shutdown the output and notifyChannelPromise.private voidshutdownOutputDone(ChannelFuture shutdownOutputFuture, ChannelPromise promise)protected booleansocketIsEmpty(int flags)Return if the socket is guaranteed to be empty when the submitted io was executed and the completion event be created.-
Methods inherited from class io.netty.channel.uring.AbstractIoUringChannel
allowMultiShotPollIn, autoReadCleared, checkResolvable, doBeginRead, doBind, doClose, doDeregister, doDisconnect, doShutdownOutput, doWrite, fd, isActive, isCompatible, isOpen, localAddress0, newDirectBuffer, newDirectBuffer, nextOpsId, registration, remoteAddress0, resetCachedAddresses, schedulePollRdHup, scheduleWriteIfNeeded, submitAndRunNow
-
Methods inherited from class io.netty.channel.AbstractChannel
closeFuture, compareTo, doRegister, equals, eventLoop, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, localAddress, maxMessagesPerWrite, newChannelPipeline, newId, parent, pipeline, remoteAddress, toString, unsafe, validateFileRegion, voidPromise
-
Methods inherited from class io.netty.util.DefaultAttributeMap
attr, hasAttr
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.util.AttributeMap
attr, hasAttr
-
Methods inherited from interface io.netty.channel.Channel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, config, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, eventLoop, flush, getOption, id, isActive, isOpen, isRegistered, isWritable, localAddress, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, setOption, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlush
-
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
METADATA
private static final ChannelMetadata METADATA
-
FILE_REGION_MAX_CHUNK_SIZE
private static final int FILE_REGION_MAX_CHUNK_SIZE
Maximum bytes per chunk when converting a genericFileRegionto aByteBuffor the io_uring async send path. Overridable via theio.netty.iouring.fileRegionChunkSizesystem property; capped at 16 MiB to guard against pathological configurations that would risk direct-memory OOM.
-
writeOpCode
byte writeOpCode
-
writeId
long writeId
-
readOpCode
byte readOpCode
-
readId
long readId
-
bufferRing
private IoUringBufferRing bufferRing
-
-
Constructor Detail
-
AbstractIoUringStreamChannel
AbstractIoUringStreamChannel(Channel parent, LinuxSocket socket, boolean active)
-
AbstractIoUringStreamChannel
AbstractIoUringStreamChannel(Channel parent, LinuxSocket socket, java.net.SocketAddress remote)
-
-
Method Detail
-
isStreamSocket
protected final boolean isStreamSocket()
- Specified by:
isStreamSocketin classAbstractIoUringChannel
-
metadata
public ChannelMetadata metadata()
Description copied from interface:Channel
-
newUnsafe
protected AbstractIoUringChannel.AbstractUringUnsafe newUnsafe()
Description copied from class:AbstractChannelCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel- Specified by:
newUnsafein classAbstractChannel
-
shutdown
public final ChannelFuture shutdown()
Description copied from interface:DuplexChannelWill shutdown the input and output sides of this channel.- Specified by:
shutdownin interfaceDuplexChannel- Returns:
- will be completed when both shutdown operations complete.
-
shutdown
public final ChannelFuture shutdown(ChannelPromise promise)
Description copied from interface:DuplexChannelWill shutdown the input and output sides of this channel.- Specified by:
shutdownin interfaceDuplexChannel- Parameters:
promise- will be completed when both shutdown operations complete.- Returns:
- will be completed when both shutdown operations complete.
-
doShutdownOutput0
protected final void doShutdownOutput0() throws java.lang.ExceptionDescription copied from class:AbstractIoUringChannelPerforms the actual output shutdown. Overridden by subclasses that support it.- Overrides:
doShutdownOutput0in classAbstractIoUringChannel- Throws:
java.lang.Exception
-
shutdownInput0
private void shutdownInput0(ChannelPromise promise)
-
isOutputShutdown
public final boolean isOutputShutdown()
- Specified by:
isOutputShutdownin interfaceDuplexChannel- See Also:
Socket.isOutputShutdown()
-
isInputShutdown
public final boolean isInputShutdown()
Description copied from interface:DuplexChannelReturnstrueif and only if the remote peer shut down its output so that no more data is received from this channel. Note that the semantic of this method is different from that ofSocket.shutdownInput()andSocket.isInputShutdown().- Specified by:
isInputShutdownin interfaceDuplexChannel
-
isShutdown
public final boolean isShutdown()
Description copied from interface:DuplexChannelDetermine if both the input and output of this channel have been shutdown.- Specified by:
isShutdownin interfaceDuplexChannel
-
shutdownOutput
public final ChannelFuture shutdownOutput()
- Specified by:
shutdownOutputin interfaceDuplexChannel- See Also:
Socket.shutdownOutput()
-
shutdownOutput
public final ChannelFuture shutdownOutput(ChannelPromise promise)
Description copied from interface:DuplexChannelWill shutdown the output and notifyChannelPromise.- Specified by:
shutdownOutputin interfaceDuplexChannel- See Also:
Socket.shutdownOutput()
-
shutdownInput
public final ChannelFuture shutdownInput()
- Specified by:
shutdownInputin interfaceDuplexChannel- See Also:
Socket.shutdownInput()
-
shutdownInput
public final ChannelFuture shutdownInput(ChannelPromise promise)
Description copied from interface:DuplexChannelWill shutdown the input and notifyChannelPromise.- Specified by:
shutdownInputin interfaceDuplexChannel- See Also:
Socket.shutdownInput()
-
shutdownOutputDone
private void shutdownOutputDone(ChannelFuture shutdownOutputFuture, ChannelPromise promise)
-
shutdownDone
private static void shutdownDone(ChannelFuture shutdownOutputFuture, ChannelFuture shutdownInputFuture, ChannelPromise promise)
-
doRegister
protected final void doRegister(ChannelPromise promise)
Description copied from class:AbstractChannelIs called after theChannelis registered with itsEventLoopas part of the register process. Subclasses may override this method- Overrides:
doRegisterin classAbstractIoUringChannel- Parameters:
promise-ChannelPromisethat must be notified once done to continue the registration.
-
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 classAbstractIoUringChannel
-
cancelOutstandingReads
protected final void cancelOutstandingReads(IoRegistration registration, int numOutstandingReads)
Description copied from class:AbstractIoUringChannelCancel all outstanding reads- Specified by:
cancelOutstandingReadsin classAbstractIoUringChannel- Parameters:
registration- theIoRegistration.numOutstandingReads- the number of outstanding reads, or-1if multi-shot was used.
-
cancelOutstandingWrites
protected final void cancelOutstandingWrites(IoRegistration registration, int numOutstandingWrites)
Description copied from class:AbstractIoUringChannelCancel all outstanding writes- Specified by:
cancelOutstandingWritesin classAbstractIoUringChannel- Parameters:
registration- theIoRegistration.numOutstandingWrites- the number of outstanding writes.
-
socketIsEmpty
protected boolean socketIsEmpty(int flags)
Description copied from class:AbstractIoUringChannelReturn if the socket is guaranteed to be empty when the submitted io was executed and the completion event be created.- Specified by:
socketIsEmptyin classAbstractIoUringChannel- Parameters:
flags- the flags that were part of the completion- Returns:
trueif empty.
-
shouldCompleteReadLoop
protected boolean shouldCompleteReadLoop(int flags, boolean multishot)
-
isPollInFirst
boolean isPollInFirst()
- Specified by:
isPollInFirstin classAbstractIoUringChannel
-
-