Top Description Inners Fields Constructors Methods
io.netty5.channel.local

public Class LocalChannel

extends AbstractChannel<LocalServerChannel, LocalAddress, LocalAddress>
implements LocalChannelUnsafe
Class Inheritance
All Implemented Interfaces
io.netty5.channel.local.LocalChannelUnsafe
Imports
io.netty5.buffer.Buffer, .DefaultBufferAllocators, io.netty5.buffer.internal.InternalBufferUtils, .ResourceSupport, io.netty5.channel.ChannelOption, .ChannelShutdownDirection, .AbstractChannel, .Channel, .EventLoop, io.netty5.util.ReferenceCounted, .Resource, .ReferenceCountUtil, io.netty5.util.concurrent.FastThreadLocal, .Future, io.netty5.util.internal.PlatformDependent, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.net.ConnectException, .SocketAddress, java.nio.channels.AlreadyConnectedException, .ClosedChannelException, .NotYetConnectedException, java.util.Queue, java.util.concurrent.atomic.AtomicReferenceFieldUpdater

A Channel for the local transport.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static enum

Field Summary

Modifier and TypeField and Description
private static final AtomicReferenceFieldUpdater<LocalChannel, Future<V>>
private volatile Future<?>
pack-priv final Queue<Object>
private volatile boolean
private volatile LocalAddress
private static final InternalLogger
private static final int
private volatile boolean
private volatile LocalChannel
private volatile boolean
private final Runnable
private volatile LocalAddress
private static final FastThreadLocal<LocalChannel.ReaderStackDepth>
private volatile LocalChannel.State
private volatile boolean

Constructor Summary

AccessConstructor and Description
public
protected

Method Summary

Modifier and TypeMethod and Description
public void
public void
protected void
doBind(SocketAddress
the SocketAddress to bound to.
localAddress
)

Implements abstract io.netty5.channel.AbstractChannel.doBind.

Bind the Channel to the SocketAddress
protected void
protected boolean
doConnect(SocketAddress
the address of the remote peer.
remoteAddress
,
SocketAddress
the local address of this channel.
localAddress
,
Buffer
the initial data that is written during connect (if ChannelOption#TCP_FASTOPEN_CONNECT is supported and configured). If data is written care must be taken to update the reader offset.
initialData
)

Implements abstract io.netty5.channel.AbstractChannel.doConnect.

Connect to remote peer.
protected void
doDisconnect()

Implements abstract io.netty5.channel.AbstractChannel.doDisconnect.

Disconnect this Channel from its remote peer
protected boolean
doFinishConnect(LocalAddress
the remote address of the peer.
requestedRemoteAddress
)

Implements abstract io.netty5.channel.AbstractChannel.doFinishConnect.

Finish a connect request.
protected void
doRead(boolean
true if a read was already pending when read() was called.
wasReadPendingAlready
)

Implements abstract io.netty5.channel.AbstractChannel.doRead.

Schedule a read operation.
protected boolean
doReadNow(AbstractChannel<LocalServerChannel, LocalAddress, LocalAddress>.ReadSink
the ReadSink that should be called with messages that are read from the transport to propagate these.
readSink
)

Implements abstract io.netty5.channel.AbstractChannel.doReadNow.

Try to read a message from the transport and dispatch it via ReadSink#processRead(int, int, Object).
protected void
doShutdown(ChannelShutdownDirection
the direction to shut down.
direction
)

Implements abstract io.netty5.channel.AbstractChannel.doShutdown.

Shutdown one direction of the Channel.
protected void
doWriteNow(AbstractChannel<LocalServerChannel, LocalAddress, LocalAddress>.WriteSink
the WriteSink that must be completed with the write progress. WriteSink#complete(long, long, int, boolean) or WriteSink#complete(long, Throwable, boolean) must be called exactly once before this method returns non-exceptional.
writeSink
)

Implements abstract io.netty5.channel.AbstractChannel.doWriteNow.

Called in a loop when writes should be performed until this method returns false or there are no more messages to write.
private void
private void
private void
public boolean
isActive()

Implements io.netty5.channel.Channel.isActive.

Return true if the Channel is active and so connected.
public boolean
isOpen()

Implements io.netty5.channel.Channel.isOpen.

Returns true if the Channel is open and may get active later
public boolean
isShutdown(ChannelShutdownDirection direction)

Implements io.netty5.channel.Channel.isShutdown.

Returns true if the ChannelShutdownDirection of the Channel was shutdown before.
protected LocalAddress
localAddress0()

Implements abstract io.netty5.channel.AbstractChannel.localAddress0.

Returns the SocketAddress which is bound locally.
public void
private void
protected LocalAddress
remoteAddress0()

Implements abstract io.netty5.channel.AbstractChannel.remoteAddress0.

Return the SocketAddress which the Channel is connected to.
private void
private void
tryClose(boolean isActive)

private void
protected void
writeLoopComplete(boolean
true if all messages were written during the write loop, false otherwise.
allWritten
)

Overrides io.netty5.channel.AbstractChannel.writeLoopComplete.

Called once the write loop completed.
Inherited from io.netty5.channel.AbstractChannel:
bufferAllocatorcacheAddressescloseFuturecloseTransportcompareTodoClearScheduledReadequalsexecutorfilterOutboundMessagefinishConnectgetExtendedOptiongetOptionhashCodeidisConnectPendingisExtendedOptionSupportedisOptionSupportedisReadPendingisRegisteredisSupportingDisconnectisWriteFlushedScheduledlocalAddressnewChannelPipelinenewSupportedIdentityOptionsSetparentpipelineprepareToClosereadBufferAllocatorreadHandlereadIfIsAutoReadreadLoopCompletereadNowremoteAddresssetExtendedOptionsetOptionshutdownReadSidetoStringvalidateEventLoopGroupvalidateFileRegionwritableByteswriteFlushedwriteFlushedNowwriteHandle

Field Detail

FINISH_READ_FUTURE_UPDATERback to summary
private static final AtomicReferenceFieldUpdater<LocalChannel, Future<V>> FINISH_READ_FUTURE_UPDATER
Annotations
@SuppressWarnings:rawtypes
finishReadFutureback to summary
private volatile Future<?> finishReadFuture
inboundBufferback to summary
pack-priv final Queue<Object> inboundBuffer
inputShutdownback to summary
private volatile boolean inputShutdown
localAddressback to summary
private volatile LocalAddress localAddress

Hides io.netty5.channel.AbstractChannel.localAddress.

loggerback to summary
private static final InternalLogger logger

Hides io.netty5.channel.AbstractChannel.logger.

MAX_READER_STACK_DEPTHback to summary
private static final int MAX_READER_STACK_DEPTH
outputShutdownback to summary
private volatile boolean outputShutdown
peerback to summary
private volatile LocalChannel peer
readInProgressback to summary
private volatile boolean readInProgress
readNowTaskback to summary
private final Runnable readNowTask
remoteAddressback to summary
private volatile LocalAddress remoteAddress

Hides io.netty5.channel.AbstractChannel.remoteAddress.

STACK_DEPTHback to summary
private static final FastThreadLocal<LocalChannel.ReaderStackDepth> STACK_DEPTH
stateback to summary
private volatile LocalChannel.State state
writeInProgressback to summary
private volatile boolean writeInProgress

Constructor Detail

LocalChannelback to summary
public LocalChannel(EventLoop eventLoop)
LocalChannelback to summary
protected LocalChannel(LocalServerChannel parent, EventLoop eventLoop, LocalChannel peer)

Method Detail

closeTransportNowback to summary
public void closeTransportNow()

Implements io.netty5.channel.local.LocalChannelUnsafe.closeTransportNow.

Annotations
@Override
deregisterTransportNowback to summary
public void deregisterTransportNow()

Implements io.netty5.channel.local.LocalChannelUnsafe.deregisterTransportNow.

Annotations
@Override
doBindback to summary
protected void doBind(SocketAddress localAddress) throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doBind.

Doc from io.netty5.channel.AbstractChannel.doBind.

Bind the Channel to the SocketAddress

Parameters
localAddress:SocketAddress

the SocketAddress to bound to.

Annotations
@Override
Exceptions
Exception:
when an error happens.
doCloseback to summary
protected void doClose() throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doClose.

Doc from io.netty5.channel.AbstractChannel.doClose.

Close the Channel

Annotations
@Override
Exceptions
Exception:
thrown on error.
doConnectback to summary
protected boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress, Buffer initialData) throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doConnect.

Doc from io.netty5.channel.AbstractChannel.doConnect.

Connect to remote peer. This method should never be directly called.

Parameters
remoteAddress:SocketAddress

the address of the remote peer.

localAddress:SocketAddress

the local address of this channel.

initialData:Buffer

the initial data that is written during connect (if ChannelOption#TCP_FASTOPEN_CONNECT is supported and configured). If data is written care must be taken to update the reader offset.

Returns:boolean

true if the connect operation was completed, false if finishConnect() will be called later again to try finish connecting.

Annotations
@Override
Exceptions
Exception:
thrown on error.
doDisconnectback to summary
protected void doDisconnect() throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doDisconnect.

Doc from io.netty5.channel.AbstractChannel.doDisconnect.

Disconnect this Channel from its remote peer

Annotations
@Override
Exceptions
Exception:
thrown on error.
doFinishConnectback to summary
protected boolean doFinishConnect(LocalAddress requestedRemoteAddress) throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doFinishConnect.

Doc from io.netty5.channel.AbstractChannel.doFinishConnect.

Finish a connect request. This method should never be directly called, use finishConnect() instead.

Parameters
requestedRemoteAddress:LocalAddress

the remote address of the peer.

Returns:boolean

true if the connect operations was completed, false if finishConnect() will be called later again to try finishing the connect operation.

Annotations
@Override
Exceptions
Exception:
thrown on error.
doReadback to summary
protected void doRead(boolean wasReadPendingAlready) throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doRead.

Doc from io.netty5.channel.AbstractChannel.doRead.

Schedule a read operation.

Parameters
wasReadPendingAlready:boolean

true if a read was already pending when read() was called.

Annotations
@Override
Exceptions
Exception:
thrown on error.
doReadNowback to summary
protected boolean doReadNow(AbstractChannel<LocalServerChannel, LocalAddress, LocalAddress>.ReadSink readSink)

Implements abstract io.netty5.channel.AbstractChannel.doReadNow.

Doc from io.netty5.channel.AbstractChannel.doReadNow.

Try to read a message from the transport and dispatch it via ReadSink#processRead(int, int, Object). This method is called in a loop until there is nothing more messages to read or the channel was shutdown / closed. This method should never be called directly by sub-classes, use readNow() instead.

Parameters
readSink:AbstractChannel<LocalServerChannel, LocalAddress, LocalAddress>.ReadSink

the ReadSink that should be called with messages that are read from the transport to propagate these.

Returns:boolean

true if the channel should be shutdown / closed.

Annotations
@Override
doShutdownback to summary
protected void doShutdown(ChannelShutdownDirection direction)

Implements abstract io.netty5.channel.AbstractChannel.doShutdown.

Doc from io.netty5.channel.AbstractChannel.doShutdown.

Shutdown one direction of the Channel.

Parameters
direction:ChannelShutdownDirection

the direction to shut down.

Annotations
@Override
doWriteNowback to summary
protected void doWriteNow(AbstractChannel<LocalServerChannel, LocalAddress, LocalAddress>.WriteSink writeSink) throws Exception

Implements abstract io.netty5.channel.AbstractChannel.doWriteNow.

Doc from io.netty5.channel.AbstractChannel.doWriteNow.

Called in a loop when writes should be performed until this method returns false or there are no more messages to write. Implementations are responsible for handling partial writes, which for example means that if Buffers are written partial implementations need to ensure the readerOffset is updated accordingly.

Parameters
writeSink:AbstractChannel<LocalServerChannel, LocalAddress, LocalAddress>.WriteSink

the WriteSink that must be completed with the write progress. WriteSink#complete(long, long, int, boolean) or WriteSink#complete(long, Throwable, boolean) must be called exactly once before this method returns non-exceptional.

Annotations
@Override
Exceptions
Exception:
if an error happened during writing. This will also terminate the write loop.
finishConnectAsyncback to summary
private void finishConnectAsync()
finishPeerReadback to summary
private void finishPeerRead(final LocalChannel peer)
finishPeerRead0back to summary
private void finishPeerRead0(LocalChannel peer)
isActiveback to summary
public boolean isActive()

Implements io.netty5.channel.Channel.isActive.

Doc from io.netty5.channel.Channel.isActive.

Return true if the Channel is active and so connected.

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements io.netty5.channel.Channel.isOpen.

Doc from io.netty5.channel.Channel.isOpen.

Returns true if the Channel is open and may get active later

Annotations
@Override
isShutdownback to summary
public boolean isShutdown(ChannelShutdownDirection direction)

Implements io.netty5.channel.Channel.isShutdown.

Doc from io.netty5.channel.Channel.isShutdown.

Returns true if the ChannelShutdownDirection of the Channel was shutdown before.

Annotations
@Override
localAddress0back to summary
protected LocalAddress localAddress0()

Implements abstract io.netty5.channel.AbstractChannel.localAddress0.

Doc from io.netty5.channel.AbstractChannel.localAddress0.

Returns the SocketAddress which is bound locally.

Returns:LocalAddress

the local address if any, null otherwise.

Annotations
@Override
registerTransportNowback to summary
public void registerTransportNow()

Implements io.netty5.channel.local.LocalChannelUnsafe.registerTransportNow.

Annotations
@Override
releaseInboundBuffersback to summary
private void releaseInboundBuffers()
remoteAddress0back to summary
protected LocalAddress remoteAddress0()

Implements abstract io.netty5.channel.AbstractChannel.remoteAddress0.

Doc from io.netty5.channel.AbstractChannel.remoteAddress0.

Return the SocketAddress which the Channel is connected to.

Returns:LocalAddress

the remote address if any, null otherwise.

Annotations
@Override
runFinishPeerReadTaskback to summary
private void runFinishPeerReadTask(final LocalChannel peer)
tryCloseback to summary
private void tryClose(boolean isActive)
writeFlushedAsyncback to summary
private void writeFlushedAsync()
writeLoopCompleteback to summary
protected void writeLoopComplete(boolean allWritten)

Overrides io.netty5.channel.AbstractChannel.writeLoopComplete.

Doc from io.netty5.channel.AbstractChannel.writeLoopComplete.

Called once the write loop completed. Subclasses might override this method for custom logic but should also call super.

Parameters
allWritten:boolean

true if all messages were written during the write loop, false otherwise.

Annotations
@Override
io.netty5.channel.local back to summary

private final Class LocalChannel.ReaderStackDepth

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stackDepthback to summary
private int stackDepth

Constructor Detail

ReaderStackDepthback to summary
private ReaderStackDepth()

Method Detail

decrementback to summary
pack-priv void decrement()
incrementIfPossibleback to summary
pack-priv boolean incrementIfPossible()
io.netty5.channel.local back to summary

private final Enum LocalChannel.State

extends Enum<LocalChannel.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final LocalChannel.State
public static final LocalChannel.State
public static final LocalChannel.State
public static final LocalChannel.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static LocalChannel.State
public static LocalChannel.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BOUNDback to summary
public static final LocalChannel.State BOUND
CLOSEDback to summary
public static final LocalChannel.State CLOSED
CONNECTEDback to summary
public static final LocalChannel.State CONNECTED
OPENback to summary
public static final LocalChannel.State OPEN

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static LocalChannel.State valueOf(String name)
valuesback to summary
public static LocalChannel.State[] values()