Top Inners Fields Constructors Methods
io.netty.channel.kqueue

public abstract Class AbstractKQueueStreamChannel

extends AbstractKQueueChannel
implements DuplexChannel
Class Inheritance
All Implemented Interfaces
io.netty.channel.socket.DuplexChannel, io.netty.channel.Channel, java.lang.Comparable, io.netty.channel.ChannelOutboundInvoker, io.netty.util.AttributeMap
Known Direct Subclasses
io.netty.channel.kqueue.KQueueDomainSocketChannel, io.netty.channel.kqueue.KQueueSocketChannel
Annotations
@UnstableApi
Imports
io.netty.buffer.ByteBuf, .ByteBufAllocator, io.netty.channel.Channel, .ChannelConfig, .ChannelFuture, .ChannelFutureListener, .ChannelMetadata, .ChannelOutboundBuffer, .ChannelPipeline, .ChannelPromise, .DefaultFileRegion, .EventLoop, .FileRegion, io.netty.channel.internal.ChannelUtils, io.netty.channel.socket.DuplexChannel, io.netty.channel.unix.IovArray, .SocketWritableByteChannel, .UnixChannelUtil, io.netty.util.internal.StringUtil, .UnstableApi, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.io.IOException, java.net.SocketAddress, java.nio.ByteBuffer, java.nio.channels.WritableByteChannel, java.util.concurrent.Executor

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
pack-priv class

Field Summary

Modifier and TypeField and Description
private WritableByteChannel
private static final String
private final Runnable
private static final InternalLogger
private static final ChannelMetadata
Inherited from io.netty.channel.kqueue.AbstractKQueueChannel:
activeinputClosedSeenErrorOnReadreadReadyRunnablePendingsocket

Constructor Summary

AccessConstructor and Description
pack-priv
AbstractKQueueStreamChannel(Channel parent, BsdSocket fd, boolean active)

pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
adjustMaxBytesPerGatheringWrite(long attempted, long written, long oldMaxBytesPerGatheringWrite)

protected final void
doShutdownOutput()

Overrides io.netty.channel.AbstractChannel.doShutdownOutput.

Called when conditions justify shutting down the output portion of the channel.
protected void
doWrite(ChannelOutboundBuffer in)

Implements abstract io.netty.channel.AbstractChannel.doWrite.

Flush the content of the given buffer to the remote peer.
private int

Returns:

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:
  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
doWriteMultiple
(ChannelOutboundBuffer
the collection which contains objects to write.
in
)

Attempt to write multiple ByteBuf objects.

protected int

Returns:

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:
  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
doWriteSingle
(ChannelOutboundBuffer
the collection which contains objects to write.
in
)

Attempt to write a single object.

protected Object
filterOutboundMessage(Object msg)

Overrides io.netty.channel.AbstractChannel.filterOutboundMessage.

Invoked when a new message is added to a ChannelOutboundBuffer of this AbstractChannel, so that the Channel implementation converts the message to another.
public boolean
isInputShutdown()

Implements io.netty.channel.socket.DuplexChannel.isInputShutdown.

Returns true if and only if the remote peer shut down its output so that no more data is received from this channel.
public boolean
public boolean
isShutdown()

Implements io.netty.channel.socket.DuplexChannel.isShutdown.

Determine if both the input and output of this channel have been shutdown.
public ChannelMetadata
protected AbstractKQueueChannel.AbstractKQueueUnsafe
newUnsafe()

Implements abstract io.netty.channel.kqueue.AbstractKQueueChannel.newUnsafe.

Create a new AbstractUnsafe instance which will be used for the life-time of the Channel
public ChannelFuture
shutdown()

Implements io.netty.channel.socket.DuplexChannel.shutdown.

Will shutdown the input and output sides of this channel.
public ChannelFuture
shutdown(final ChannelPromise
will be completed when both shutdown operations complete.
promise
)

Implements io.netty.channel.socket.DuplexChannel.shutdown.

Will shutdown the input and output sides of this channel.
private static void
shutdownDone(ChannelFuture shutdownOutputFuture, ChannelFuture shutdownInputFuture, ChannelPromise promise)

public ChannelFuture
public ChannelFuture
shutdownInput(final ChannelPromise promise)

Implements io.netty.channel.socket.DuplexChannel.shutdownInput.

Will shutdown the input and notify ChannelPromise.
private void
public ChannelFuture
public ChannelFuture
shutdownOutput(final ChannelPromise promise)

Implements io.netty.channel.socket.DuplexChannel.shutdownOutput.

Will shutdown the output and notify ChannelPromise.
private void
shutdownOutputDone(final ChannelFuture shutdownOutputFuture, final ChannelPromise promise)

private int

Returns:

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:
  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
writeBytes
(ChannelOutboundBuffer
the collection which contains objects to write.
in
,
ByteBuf
the ByteBuf from which the bytes should be written
buf
)

Write bytes form the given ByteBuf to the underlying java.nio.channels.Channel.

private int

Returns:

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:
  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
writeBytesMultiple
(ChannelOutboundBuffer
the collection which contains objects to write.
in
,
IovArray
The array which contains the content to write.
array
)

Write multiple bytes via IovArray.

private int

Returns:

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:
  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
writeBytesMultiple
(ChannelOutboundBuffer
the collection which contains objects to write.
in
,
ByteBuffer[]
The buffers to write.
nioBuffers
,
int
The number of buffers to write.
nioBufferCnt
,
long
The number of bytes we expect to write.
expectedWrittenBytes
,
long
The maximum number of bytes we should attempt to write.
maxBytesPerGatheringWrite
)

Write multiple bytes via ByteBuffer array.

private int

Returns:

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:
  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
writeDefaultFileRegion
(ChannelOutboundBuffer
the collection which contains objects to write.
in
,
DefaultFileRegion
the DefaultFileRegion from which the bytes should be written
region
)

Write a DefaultFileRegion

private int

Returns:

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:
  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
writeFileRegion
(ChannelOutboundBuffer
the collection which contains objects to write.
in
,
FileRegion
the FileRegion from which the bytes should be written
region
)

Write a FileRegion

Inherited from io.netty.channel.kqueue.AbstractKQueueChannel:
checkResolvableclearReadFilterconfigdoBeginReaddoBinddoClosedoConnectdoConnect0doDeregisterdoDisconnectdoReadBytesdoRegisterdoWriteBytesfdisActiveisCompatibleisOpenisSoErrorZerolocalAddress0newDirectBuffernewDirectBufferreadFilterremoteAddress0resetCachedAddressesshouldBreakReadReadyunregisterFilterswriteFilter

Field Detail

byteChannelback to summary
private WritableByteChannel byteChannel
EXPECTED_TYPESback to summary
private static final String EXPECTED_TYPES
flushTaskback to summary
private final Runnable flushTask
loggerback to summary
private static final InternalLogger logger

Hides io.netty.channel.AbstractChannel.logger.

METADATAback to summary
private static final ChannelMetadata METADATA

Hides io.netty.channel.kqueue.AbstractKQueueChannel.METADATA.

Constructor Detail

AbstractKQueueStreamChannelback to summary
pack-priv AbstractKQueueStreamChannel(Channel parent, BsdSocket fd, boolean active)
AbstractKQueueStreamChannelback to summary
pack-priv AbstractKQueueStreamChannel(Channel parent, BsdSocket fd, SocketAddress remote)
AbstractKQueueStreamChannelback to summary
pack-priv AbstractKQueueStreamChannel(BsdSocket fd)

Method Detail

adjustMaxBytesPerGatheringWriteback to summary
private void adjustMaxBytesPerGatheringWrite(long attempted, long written, long oldMaxBytesPerGatheringWrite)
doShutdownOutputback to summary
protected final void doShutdownOutput() throws Exception

Overrides io.netty.channel.AbstractChannel.doShutdownOutput.

Doc from io.netty.channel.AbstractChannel.doShutdownOutput.

Called when conditions justify shutting down the output portion of the channel. This may happen if a write operation throws an exception.

Annotations
@UnstableApi
@Override
doWriteback to summary
protected void doWrite(ChannelOutboundBuffer in) throws Exception

Implements abstract io.netty.channel.AbstractChannel.doWrite.

Doc from io.netty.channel.AbstractChannel.doWrite.

Flush the content of the given buffer to the remote peer.

Annotations
@Override
doWriteMultipleback to summary
private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception

Attempt to write multiple ByteBuf objects.

Parameters
in:ChannelOutboundBuffer

the collection which contains objects to write.

Returns:int

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:

  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
Exceptions
Exception:
If an I/O error occurs.
doWriteSingleback to summary
protected int doWriteSingle(ChannelOutboundBuffer in) throws Exception

Attempt to write a single object.

Parameters
in:ChannelOutboundBuffer

the collection which contains objects to write.

Returns:int

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:

  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
Exceptions
Exception:
If an I/O error occurs.
filterOutboundMessageback to summary
protected Object filterOutboundMessage(Object msg)

Overrides io.netty.channel.AbstractChannel.filterOutboundMessage.

Doc from io.netty.channel.AbstractChannel.filterOutboundMessage.

Invoked when a new message is added to a ChannelOutboundBuffer of this AbstractChannel, so that the Channel implementation converts the message to another. (e.g. heap buffer -> direct buffer)

Annotations
@Override
isInputShutdownback to summary
public boolean isInputShutdown()

Implements io.netty.channel.socket.DuplexChannel.isInputShutdown.

Doc from io.netty.channel.socket.DuplexChannel.isInputShutdown.

Returns true 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().

Annotations
@Override
isOutputShutdownback to summary
public boolean isOutputShutdown()

Implements io.netty.channel.socket.DuplexChannel.isOutputShutdown.

Annotations
@Override
isShutdownback to summary
public boolean isShutdown()

Implements io.netty.channel.socket.DuplexChannel.isShutdown.

Doc from io.netty.channel.socket.DuplexChannel.isShutdown.

Determine if both the input and output of this channel have been shutdown.

Annotations
@Override
metadataback to summary
public ChannelMetadata metadata()

Overrides io.netty.channel.kqueue.AbstractKQueueChannel.metadata.

Implements io.netty.channel.Channel.metadata.

Doc from io.netty.channel.Channel.metadata.

Return the ChannelMetadata of the Channel which describe the nature of the Channel.

Annotations
@Override
newUnsafeback to summary
protected AbstractKQueueChannel.AbstractKQueueUnsafe newUnsafe()

Implements abstract io.netty.channel.kqueue.AbstractKQueueChannel.newUnsafe.

Doc from io.netty.channel.AbstractChannel.newUnsafe.

Create a new AbstractUnsafe instance which will be used for the life-time of the Channel

Annotations
@Override
shutdownback to summary
public ChannelFuture shutdown()

Implements io.netty.channel.socket.DuplexChannel.shutdown.

Doc from io.netty.channel.socket.DuplexChannel.shutdown.

Will shutdown the input and output sides of this channel.

Returns:ChannelFuture

will be completed when both shutdown operations complete.

Annotations
@Override
shutdownback to summary
public ChannelFuture shutdown(final ChannelPromise promise)

Implements io.netty.channel.socket.DuplexChannel.shutdown.

Doc from io.netty.channel.socket.DuplexChannel.shutdown.

Will shutdown the input and output sides of this channel.

Parameters
promise:ChannelPromise

will be completed when both shutdown operations complete.

Returns:ChannelFuture

will be completed when both shutdown operations complete.

Annotations
@Override
shutdownDoneback to summary
private static void shutdownDone(ChannelFuture shutdownOutputFuture, ChannelFuture shutdownInputFuture, ChannelPromise promise)
shutdownInputback to summary
public ChannelFuture shutdownInput()

Implements io.netty.channel.socket.DuplexChannel.shutdownInput.

Annotations
@Override
shutdownInputback to summary
public ChannelFuture shutdownInput(final ChannelPromise promise)

Implements io.netty.channel.socket.DuplexChannel.shutdownInput.

Doc from io.netty.channel.socket.DuplexChannel.shutdownInput.

Will shutdown the input and notify ChannelPromise.

Annotations
@Override
shutdownInput0back to summary
private void shutdownInput0(ChannelPromise promise)
shutdownOutputback to summary
public ChannelFuture shutdownOutput()

Implements io.netty.channel.socket.DuplexChannel.shutdownOutput.

Annotations
@Override
shutdownOutputback to summary
public ChannelFuture shutdownOutput(final ChannelPromise promise)

Implements io.netty.channel.socket.DuplexChannel.shutdownOutput.

Doc from io.netty.channel.socket.DuplexChannel.shutdownOutput.

Will shutdown the output and notify ChannelPromise.

Annotations
@Override
shutdownOutputDoneback to summary
private void shutdownOutputDone(final ChannelFuture shutdownOutputFuture, final ChannelPromise promise)
writeBytesback to summary
private int writeBytes(ChannelOutboundBuffer in, ByteBuf buf) throws Exception

Write bytes form the given ByteBuf to the underlying java.nio.channels.Channel.

Parameters
in:ChannelOutboundBuffer

the collection which contains objects to write.

buf:ByteBuf

the ByteBuf from which the bytes should be written

Returns:int

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:

  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
writeBytesMultipleback to summary
private int writeBytesMultiple(ChannelOutboundBuffer in, IovArray array) throws IOException

Write multiple bytes via IovArray.

Parameters
in:ChannelOutboundBuffer

the collection which contains objects to write.

array:IovArray

The array which contains the content to write.

Returns:int

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:

  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
Exceptions
IOException:
If an I/O exception occurs during write.
writeBytesMultipleback to summary
private int writeBytesMultiple(ChannelOutboundBuffer in, ByteBuffer[] nioBuffers, int nioBufferCnt, long expectedWrittenBytes, long maxBytesPerGatheringWrite) throws IOException

Write multiple bytes via ByteBuffer array.

Parameters
in:ChannelOutboundBuffer

the collection which contains objects to write.

nioBuffers:ByteBuffer[]

The buffers to write.

nioBufferCnt:int

The number of buffers to write.

expectedWrittenBytes:long

The number of bytes we expect to write.

maxBytesPerGatheringWrite:long

The maximum number of bytes we should attempt to write.

Returns:int

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:

  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
Exceptions
IOException:
If an I/O exception occurs during write.
writeDefaultFileRegionback to summary
private int writeDefaultFileRegion(ChannelOutboundBuffer in, DefaultFileRegion region) throws Exception

Write a DefaultFileRegion

Parameters
in:ChannelOutboundBuffer

the collection which contains objects to write.

region:DefaultFileRegion

the DefaultFileRegion from which the bytes should be written

Returns:int

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:

  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
writeFileRegionback to summary
private int writeFileRegion(ChannelOutboundBuffer in, FileRegion region) throws Exception

Write a FileRegion

Parameters
in:ChannelOutboundBuffer

the collection which contains objects to write.

region:FileRegion

the FileRegion from which the bytes should be written

Returns:int

The value that should be decremented from the write quantum which starts at ChannelConfig#getWriteSpinCount(). The typical use cases are as follows:

  • 0 - if no write was attempted. This is appropriate if an empty ByteBuf (or other empty content) is encountered
  • 1 - if a single call to write data was made to the OS
  • ChannelUtils#WRITE_STATUS_SNDBUF_FULL - if an attempt to write data was made to the OS, but no data was accepted
io.netty.channel.kqueue back to summary

private final Class AbstractKQueueStreamChannel.KQueueSocketWritableByteChannel

extends SocketWritableByteChannel
Class Inheritance

Field Summary

Inherited from io.netty.channel.unix.SocketWritableByteChannel:
fd

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected ByteBufAllocator
Inherited from io.netty.channel.unix.SocketWritableByteChannel:
closeisOpenwritewrite

Constructor Detail

KQueueSocketWritableByteChannelback to summary
pack-priv KQueueSocketWritableByteChannel()

Method Detail

allocback to summary
protected ByteBufAllocator alloc()

Implements abstract io.netty.channel.unix.SocketWritableByteChannel.alloc.

Annotations
@Override
io.netty.channel.kqueue back to summary

pack-priv Class AbstractKQueueStreamChannel.KQueueStreamUnsafe

extends AbstractKQueueUnsafe
Class Inheritance
Known Direct Subclasses
io.netty.channel.kqueue.KQueueDomainSocketChannel.KQueueDomainUnsafe, io.netty.channel.kqueue.KQueueSocketChannel.KQueueSocketChannelUnsafe

Field Summary

Inherited from io.netty.channel.kqueue.AbstractKQueueChannel.AbstractKQueueUnsafe:
maybeMoreDataToReadreadPending

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
handleReadException(ChannelPipeline pipeline, ByteBuf byteBuf, Throwable cause, boolean close, KQueueRecvByteAllocatorHandle allocHandle)

Deprecated as a consequence of KQueueRecvByteAllocatorHandle being deprecated.
protected Executor
pack-priv void
Inherited from io.netty.channel.kqueue.AbstractKQueueChannel.AbstractKQueueUnsafe:
clearReadFilter0connectexecuteReadReadyRunnablefailConnectPromiseflush0readEOFreadReadyreadReadyBeforereadReadyFinallyrecvBufAllocHandleshutdownInputwriteReady

Constructor Detail

KQueueStreamUnsafeback to summary
pack-priv KQueueStreamUnsafe()

Method Detail

handleReadExceptionback to summary
private void handleReadException(ChannelPipeline pipeline, ByteBuf byteBuf, Throwable cause, boolean close, KQueueRecvByteAllocatorHandle allocHandle)

Deprecated

as a consequence of KQueueRecvByteAllocatorHandle being deprecated. See corresponding docs for further information.

prepareToCloseback to summary
protected Executor prepareToClose()

Overrides io.netty.channel.AbstractChannel.AbstractUnsafe.prepareToClose.

Doc from io.netty.channel.AbstractChannel.AbstractUnsafe.prepareToClose.

Prepares to close the Channel. If this method returns an Executor, the caller must call the Executor#execute(Runnable) method with a task that calls doClose() on the returned Executor. If this method returns null, doClose() must be called from the caller thread. (i.e. EventLoop)

Annotations
@Override
readReadyback to summary
pack-priv void readReady(final KQueueRecvByteAllocatorHandle allocHandle)

Implements abstract io.netty.channel.kqueue.AbstractKQueueChannel.AbstractKQueueUnsafe.readReady.

Deprecated

as a consequence of KQueueRecvByteAllocatorHandle being deprecated. See corresponding docs for further information.

Annotations
@Override