Class LocalChannel
java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
io.netty.channel.local.LocalChannel
- All Implemented Interfaces:
Channel, ChannelOutboundInvoker, AttributeMap, java.lang.Comparable<Channel>
A
Channel for the local transport.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprivate static enumNested classes/interfaces inherited from class AbstractChannel
AbstractChannel.AbstractUnsafeNested classes/interfaces inherited from interface Channel
Channel.Unsafe -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ChannelConfigprivate ChannelPromiseprivate static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<LocalChannel, Future> private Future<?> private final java.lang.Runnable(package private) final java.util.Queue<java.lang.Object> private LocalAddressprivate static final InternalLoggerprivate static final intprivate static final ChannelMetadataprivate LocalChannelprivate booleanprivate final java.lang.Runnableprivate IoRegistrationprivate LocalAddressprivate LocalChannel.Stateprivate static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<LocalChannel, LocalChannel.State> private boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLocalChannel(LocalServerChannel parent, LocalChannel peer) -
Method Summary
Modifier and TypeMethodDescriptionconfig()Returns the configuration of this channel.protected voidSchedule a read operation.protected voiddoBind(java.net.SocketAddress localAddress) Bind theChannelto theSocketAddressprotected voiddoClose()Close theChannelprotected voidprotected voidDisconnect thisChannelfrom its remote peerprotected voiddoRegister(ChannelPromise promise) protected voidFlush the content of the given buffer to the remote peer.private voidfinishPeerRead(LocalChannel peer) private voidfinishPeerRead0(LocalChannel peer) booleanisActive()Returntrueif theChannelis active and so connected.protected booleanisCompatible(EventLoop loop) Returntrueif the givenEventLoopis compatible with this instance.booleanisOpen()Returnstrueif theChannelis open and may get active laterReturns the local address where this channel is bound to.protected java.net.SocketAddressReturns theSocketAddresswhich is bound locally.metadata()protected AbstractChannel.AbstractUnsafeCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannelparent()Returns the parent of this channel.private voidprivate voidprivate voidReturns the remote address where this channel is connected to.protected java.net.SocketAddressReturn theSocketAddresswhich theChannelis connected to.private voidprivate voidprivate voidtryClose(boolean isActive) Methods inherited from class AbstractChannel
closeFuture, compareTo, doRegister, doShutdownOutput, equals, eventLoop, filterOutboundMessage, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, maxMessagesPerWrite, newChannelPipeline, newId, pipeline, 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, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, flush, getOption, isWritable, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, read, setOption, write, write, writeAndFlush, writeAndFlush
-
Field Details
-
logger
-
FINISH_READ_FUTURE_UPDATER
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<LocalChannel, Future> FINISH_READ_FUTURE_UPDATER -
STATE_UPDATER
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<LocalChannel, LocalChannel.State> STATE_UPDATER -
METADATA
-
MAX_READER_STACK_DEPTH
private static final int MAX_READER_STACK_DEPTH- See Also:
-
config
-
inboundBuffer
final java.util.Queue<java.lang.Object> inboundBuffer -
readTask
private final java.lang.Runnable readTask -
finishReadTask
private final java.lang.Runnable finishReadTask -
registration
-
state
-
peer
-
localAddress
-
remoteAddress
-
connectPromise
-
readInProgress
private volatile boolean readInProgress -
writeInProgress
private volatile boolean writeInProgress -
finishReadFuture
-
-
Constructor Details
-
LocalChannel
public LocalChannel() -
LocalChannel
-
-
Method Details
-
metadata
Description copied from interface:Channel -
config
Description copied from interface:ChannelReturns the configuration of this channel. -
parent
Description copied from interface:ChannelReturns the parent of this channel.- Specified by:
parentin interfaceChannel- Overrides:
parentin classAbstractChannel- Returns:
- the parent channel.
nullif this channel does not have a parent channel.
-
localAddress
Description copied from interface:ChannelReturns the local address where this channel is bound to. The returnedSocketAddressis supposed to be down-cast into more concrete type such asInetSocketAddressto retrieve the detailed information.- Specified by:
localAddressin interfaceChannel- Overrides:
localAddressin classAbstractChannel- Returns:
- the local address of this channel.
nullif this channel is not bound.
-
remoteAddress
Description copied from interface:ChannelReturns the remote address where this channel is connected to. The returnedSocketAddressis supposed to be down-cast into more concrete type such asInetSocketAddressto retrieve the detailed information.- Specified by:
remoteAddressin interfaceChannel- Overrides:
remoteAddressin classAbstractChannel- Returns:
- the remote address of this channel.
nullif this channel is not connected. If this channel is not connected but it can receive messages from arbitrary remote addresses (e.g.DatagramChannel, useDefaultAddressedEnvelope.recipient()to determine the origination of the received message as this method will returnnull.
-
isOpen
-
isActive
-
newUnsafe
Description copied from class:AbstractChannelCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel- Specified by:
newUnsafein classAbstractChannel
-
isCompatible
Description copied from class:AbstractChannelReturntrueif the givenEventLoopis compatible with this instance.- Specified by:
isCompatiblein classAbstractChannel
-
localAddress0
protected java.net.SocketAddress localAddress0()Description copied from class:AbstractChannelReturns theSocketAddresswhich is bound locally.- Specified by:
localAddress0in classAbstractChannel
-
remoteAddress0
protected java.net.SocketAddress remoteAddress0()Description copied from class:AbstractChannelReturn theSocketAddresswhich theChannelis connected to.- Specified by:
remoteAddress0in 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 void doDeregister() throws java.lang.ExceptionDescription copied from class:AbstractChannel- Overrides:
doDeregisterin classAbstractChannel- Throws:
java.lang.Exception
-
doBind
protected void doBind(java.net.SocketAddress localAddress) throws java.lang.Exception Description copied from class:AbstractChannelBind theChannelto theSocketAddress- Specified by:
doBindin classAbstractChannel- Throws:
java.lang.Exception
-
doDisconnect
protected void doDisconnect() throws java.lang.ExceptionDescription copied from class:AbstractChannelDisconnect thisChannelfrom its remote peer- Specified by:
doDisconnectin classAbstractChannel- Throws:
java.lang.Exception
-
doClose
protected void doClose() throws java.lang.ExceptionDescription copied from class:AbstractChannelClose theChannel- Specified by:
doClosein classAbstractChannel- Throws:
java.lang.Exception
-
tryClose
private void tryClose(boolean isActive) -
readInboundBeforeClose
private void readInboundBeforeClose() -
readInbound
private void readInbound() -
doBeginRead
protected void doBeginRead() throws java.lang.ExceptionDescription copied from class:AbstractChannelSchedule a read operation.- Specified by:
doBeginReadin classAbstractChannel- Throws:
java.lang.Exception
-
doWrite
Description copied from class:AbstractChannelFlush the content of the given buffer to the remote peer.- Specified by:
doWritein classAbstractChannel- Throws:
java.lang.Exception
-
finishPeerRead
-
runFinishTask0
private void runFinishTask0() -
runFinishPeerReadTask
-
releaseInboundBuffers
private void releaseInboundBuffers() -
finishPeerRead0
-