public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel implements DuplexChannel
| Modifier and Type | Class and Description |
|---|---|
private class |
AbstractEpollStreamChannel.EpollSocketWritableByteChannel |
(package private) class |
AbstractEpollStreamChannel.EpollStreamUnsafe |
private class |
AbstractEpollStreamChannel.SpliceFdTask |
private class |
AbstractEpollStreamChannel.SpliceInChannelTask |
protected class |
AbstractEpollStreamChannel.SpliceInTask |
private class |
AbstractEpollStreamChannel.SpliceOutTask |
AbstractEpollChannel.AbstractEpollUnsafeAbstractChannel.AbstractUnsafeChannel.Unsafe| Modifier and Type | Field and Description |
|---|---|
private java.nio.channels.WritableByteChannel |
byteChannel |
private static java.nio.channels.ClosedChannelException |
CLEAR_SPLICE_QUEUE_CLOSED_CHANNEL_EXCEPTION |
private ChannelPromise |
connectPromise
The future of the current connection attempt.
|
private java.util.concurrent.ScheduledFuture<?> |
connectTimeoutFuture |
private static java.nio.channels.ClosedChannelException |
DO_CLOSE_CLOSED_CHANNEL_EXCEPTION |
private static java.lang.String |
EXPECTED_TYPES |
private static java.nio.channels.ClosedChannelException |
FAIL_SPLICE_IF_CLOSED_CLOSED_CHANNEL_EXCEPTION |
private static InternalLogger |
logger |
private static ChannelMetadata |
METADATA |
private FileDescriptor |
pipeIn |
private FileDescriptor |
pipeOut |
private java.net.SocketAddress |
requestedRemoteAddress |
private static java.nio.channels.ClosedChannelException |
SPLICE_TO_CLOSED_CHANNEL_EXCEPTION |
private java.util.Queue<AbstractEpollStreamChannel.SpliceInTask> |
spliceQueue |
active, epollInReadyRunnablePending, flags, inputClosedSeenErrorOnRead, socket| Modifier | Constructor and Description |
|---|---|
protected |
AbstractEpollStreamChannel(Channel parent,
int fd) |
(package private) |
AbstractEpollStreamChannel(Channel parent,
LinuxSocket fd) |
protected |
AbstractEpollStreamChannel(int fd) |
(package private) |
AbstractEpollStreamChannel(LinuxSocket fd) |
protected |
AbstractEpollStreamChannel(LinuxSocket fd,
boolean active) |
| Modifier and Type | Method and Description |
|---|---|
private void |
addToSpliceQueue(AbstractEpollStreamChannel.SpliceInTask task) |
private void |
addToSpliceQueue0(AbstractEpollStreamChannel.SpliceInTask task) |
private void |
clearSpliceQueue() |
protected void |
doClose()
Close the
Channel |
protected boolean |
doConnect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Connect to the remote peer
|
protected void |
doWrite(ChannelOutboundBuffer in)
Flush the content of the given buffer to the remote peer.
|
private boolean |
doWriteMultiple(ChannelOutboundBuffer in,
int writeSpinCount) |
protected boolean |
doWriteSingle(ChannelOutboundBuffer in,
int writeSpinCount) |
private void |
failSpliceIfClosed(ChannelPromise promise) |
protected java.lang.Object |
filterOutboundMessage(java.lang.Object msg)
Invoked when a new message is added to a
ChannelOutboundBuffer of this AbstractChannel, so that
the Channel implementation converts the message to another. |
boolean |
isInputShutdown()
Returns
true if and only if the remote peer shut down its output so that no more
data is received from this channel. |
boolean |
isOutputShutdown() |
boolean |
isShutdown()
Determine if both the input and output of this channel have been shutdown.
|
ChannelMetadata |
metadata()
|
protected AbstractEpollChannel.AbstractEpollUnsafe |
newUnsafe()
Create a new
AbstractChannel.AbstractUnsafe instance which will be used for the life-time of the Channel |
private static void |
safeClosePipe(FileDescriptor fd) |
ChannelFuture |
shutdown()
Will shutdown the input and output sides of this channel.
|
ChannelFuture |
shutdown(ChannelPromise promise)
Will shutdown the input and output sides of this channel.
|
private void |
shutdown0(ChannelPromise promise) |
ChannelFuture |
shutdownInput() |
ChannelFuture |
shutdownInput(ChannelPromise promise)
Will shutdown the input and notify
ChannelPromise. |
private void |
shutdownInput0(ChannelPromise promise) |
ChannelFuture |
shutdownOutput() |
ChannelFuture |
shutdownOutput(ChannelPromise promise)
Will shutdown the output and notify
ChannelPromise. |
private void |
shutdownOutput0(ChannelPromise promise) |
ChannelFuture |
spliceTo(AbstractEpollStreamChannel ch,
int len)
Splice from this
AbstractEpollStreamChannel to another AbstractEpollStreamChannel. |
ChannelFuture |
spliceTo(AbstractEpollStreamChannel ch,
int len,
ChannelPromise promise)
Splice from this
AbstractEpollStreamChannel to another AbstractEpollStreamChannel. |
ChannelFuture |
spliceTo(FileDescriptor ch,
int offset,
int len)
Splice from this
AbstractEpollStreamChannel to another FileDescriptor. |
ChannelFuture |
spliceTo(FileDescriptor ch,
int offset,
int len,
ChannelPromise promise)
Splice from this
AbstractEpollStreamChannel to another FileDescriptor. |
private boolean |
writeBytes(ChannelOutboundBuffer in,
ByteBuf buf,
int writeSpinCount)
Write bytes form the given
ByteBuf to the underlying Channel. |
private boolean |
writeBytesMultiple(ChannelOutboundBuffer in,
java.nio.ByteBuffer[] nioBuffers,
int nioBufferCnt,
long expectedWrittenBytes,
int writeSpinCount) |
private boolean |
writeBytesMultiple(ChannelOutboundBuffer in,
IovArray array,
int writeSpinCount) |
private boolean |
writeDefaultFileRegion(ChannelOutboundBuffer in,
DefaultFileRegion region,
int writeSpinCount)
Write a
DefaultFileRegion |
private boolean |
writeFileRegion(ChannelOutboundBuffer in,
FileRegion region,
int writeSpinCount) |
checkResolvable, clearEpollIn, clearFlag, config, doBeginRead, doDeregister, doDisconnect, doReadBytes, doRegister, doWriteBytes, fd, isActive, isAllowHalfClosure, isCompatible, isFlagSet, isOpen, isSoErrorZero, newDirectBuffer, newDirectBuffer, setFlag, shouldBreakEpollInReadyalloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doBind, equals, eventLoop, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, localAddress0, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, remoteAddress0, toString, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlushattr, hasAttrclone, finalize, getClass, notify, notifyAll, wait, wait, waitalloc, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, config, eventLoop, flush, id, isActive, isOpen, isRegistered, isWritable, localAddress, parent, pipeline, read, remoteAddress, unsafeattr, hasAttrbind, bind, close, close, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, voidPromise, write, write, writeAndFlush, writeAndFlushprivate static final ChannelMetadata METADATA
private static final java.lang.String EXPECTED_TYPES
private static final InternalLogger logger
private static final java.nio.channels.ClosedChannelException DO_CLOSE_CLOSED_CHANNEL_EXCEPTION
private static final java.nio.channels.ClosedChannelException CLEAR_SPLICE_QUEUE_CLOSED_CHANNEL_EXCEPTION
private static final java.nio.channels.ClosedChannelException SPLICE_TO_CLOSED_CHANNEL_EXCEPTION
private static final java.nio.channels.ClosedChannelException FAIL_SPLICE_IF_CLOSED_CLOSED_CHANNEL_EXCEPTION
private ChannelPromise connectPromise
private java.util.concurrent.ScheduledFuture<?> connectTimeoutFuture
private java.net.SocketAddress requestedRemoteAddress
private java.util.Queue<AbstractEpollStreamChannel.SpliceInTask> spliceQueue
private FileDescriptor pipeIn
private FileDescriptor pipeOut
private java.nio.channels.WritableByteChannel byteChannel
protected AbstractEpollStreamChannel(Channel parent, int fd)
protected AbstractEpollStreamChannel(int fd)
AbstractEpollStreamChannel(LinuxSocket fd)
AbstractEpollStreamChannel(Channel parent, LinuxSocket fd)
protected AbstractEpollStreamChannel(LinuxSocket fd, boolean active)
protected AbstractEpollChannel.AbstractEpollUnsafe newUnsafe()
AbstractChannelAbstractChannel.AbstractUnsafe instance which will be used for the life-time of the ChannelnewUnsafe in class AbstractEpollChannelpublic ChannelMetadata metadata()
Channelmetadata in interface Channelmetadata in class AbstractEpollChannelpublic final ChannelFuture spliceTo(AbstractEpollStreamChannel ch, int len)
AbstractEpollStreamChannel to another AbstractEpollStreamChannel.
The len is the number of bytes to splice. If using Integer.MAX_VALUE it will
splice until the ChannelFuture was canceled or it was failed.
Please note:
EventLoop, otherwise an
IllegalArgumentException is thrown. EpollChannelConfig.getEpollMode() must be EpollMode.LEVEL_TRIGGERED for this and the
target AbstractEpollStreamChannelpublic final ChannelFuture spliceTo(AbstractEpollStreamChannel ch, int len, ChannelPromise promise)
AbstractEpollStreamChannel to another AbstractEpollStreamChannel.
The len is the number of bytes to splice. If using Integer.MAX_VALUE it will
splice until the ChannelFuture was canceled or it was failed.
Please note:
EventLoop, otherwise an
IllegalArgumentException is thrown. EpollChannelConfig.getEpollMode() must be EpollMode.LEVEL_TRIGGERED for this and the
target AbstractEpollStreamChannelpublic final ChannelFuture spliceTo(FileDescriptor ch, int offset, int len)
AbstractEpollStreamChannel to another FileDescriptor.
The offset is the offset for the FileDescriptor and len is the
number of bytes to splice. If using Integer.MAX_VALUE it will splice until the
ChannelFuture was canceled or it was failed.
Please note:
EpollChannelConfig.getEpollMode() must be EpollMode.LEVEL_TRIGGERED for this
AbstractEpollStreamChannelFileDescriptor will not be closed after the ChannelFuture is notifiedIllegalStateException will be thrown.public final ChannelFuture spliceTo(FileDescriptor ch, int offset, int len, ChannelPromise promise)
AbstractEpollStreamChannel to another FileDescriptor.
The offset is the offset for the FileDescriptor and len is the
number of bytes to splice. If using Integer.MAX_VALUE it will splice until the
ChannelFuture was canceled or it was failed.
Please note:
EpollChannelConfig.getEpollMode() must be EpollMode.LEVEL_TRIGGERED for this
AbstractEpollStreamChannelFileDescriptor will not be closed after the ChannelPromise is notifiedIllegalStateException will be thrown.private void failSpliceIfClosed(ChannelPromise promise)
private boolean writeBytes(ChannelOutboundBuffer in, ByteBuf buf, int writeSpinCount) throws java.lang.Exception
ByteBuf to the underlying Channel.buf - the ByteBuf from which the bytes should be writtenjava.lang.Exceptionprivate boolean writeBytesMultiple(ChannelOutboundBuffer in, IovArray array, int writeSpinCount) throws java.io.IOException
java.io.IOExceptionprivate boolean writeBytesMultiple(ChannelOutboundBuffer in, java.nio.ByteBuffer[] nioBuffers, int nioBufferCnt, long expectedWrittenBytes, int writeSpinCount) throws java.io.IOException
java.io.IOExceptionprivate boolean writeDefaultFileRegion(ChannelOutboundBuffer in, DefaultFileRegion region, int writeSpinCount) throws java.lang.Exception
DefaultFileRegionregion - the DefaultFileRegion from which the bytes should be writtenjava.lang.Exceptionprivate boolean writeFileRegion(ChannelOutboundBuffer in, FileRegion region, int writeSpinCount) throws java.lang.Exception
java.lang.Exceptionprotected void doWrite(ChannelOutboundBuffer in) throws java.lang.Exception
AbstractChanneldoWrite in class AbstractChanneljava.lang.Exceptionprotected boolean doWriteSingle(ChannelOutboundBuffer in, int writeSpinCount) throws java.lang.Exception
java.lang.Exceptionprivate boolean doWriteMultiple(ChannelOutboundBuffer in, int writeSpinCount) throws java.lang.Exception
java.lang.Exceptionprotected java.lang.Object filterOutboundMessage(java.lang.Object msg)
AbstractChannelChannelOutboundBuffer of this AbstractChannel, so that
the Channel implementation converts the message to another. (e.g. heap buffer -> direct buffer)filterOutboundMessage in class AbstractChannelprivate void shutdownOutput0(ChannelPromise promise)
private void shutdownInput0(ChannelPromise promise)
private void shutdown0(ChannelPromise promise)
public boolean isOutputShutdown()
isOutputShutdown in interface DuplexChannelSocket.isOutputShutdown()public boolean isInputShutdown()
DuplexChanneltrue if 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 of Socket.shutdownInput() and Socket.isInputShutdown().isInputShutdown in interface DuplexChannelpublic boolean isShutdown()
DuplexChannelisShutdown in interface DuplexChannelpublic ChannelFuture shutdownOutput()
shutdownOutput in interface DuplexChannelSocket.shutdownOutput()public ChannelFuture shutdownOutput(ChannelPromise promise)
DuplexChannelChannelPromise.shutdownOutput in interface DuplexChannelSocket.shutdownOutput()public ChannelFuture shutdownInput()
shutdownInput in interface DuplexChannelSocket.shutdownInput()public ChannelFuture shutdownInput(ChannelPromise promise)
DuplexChannelChannelPromise.shutdownInput in interface DuplexChannelSocket.shutdownInput()public ChannelFuture shutdown()
DuplexChannelshutdown in interface DuplexChannelpublic ChannelFuture shutdown(ChannelPromise promise)
DuplexChannelshutdown in interface DuplexChannelpromise - will be completed when both shutdown operations complete.protected void doClose()
throws java.lang.Exception
AbstractChannelChanneldoClose in class AbstractEpollChanneljava.lang.Exceptionprivate void clearSpliceQueue()
protected boolean doConnect(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
throws java.lang.Exception
java.lang.Exceptionprivate static void safeClosePipe(FileDescriptor fd)
private void addToSpliceQueue(AbstractEpollStreamChannel.SpliceInTask task)
private void addToSpliceQueue0(AbstractEpollStreamChannel.SpliceInTask task)