Package io.netty.channel.local
Class LocalChannel
java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
io.netty.channel.local.LocalChannel
- All Implemented Interfaces:
Channel
,ChannelOutboundInvoker
,AttributeMap
,Comparable<Channel>
A
Channel
for the local transport.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
private static enum
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
FieldsModifier and TypeFieldDescriptionprivate final ChannelConfig
private ChannelPromise
private static final AtomicReferenceFieldUpdater
<LocalChannel, Future> private Future
<?> private LocalAddress
private static final InternalLogger
private static final int
private static final ChannelMetadata
private LocalChannel
private boolean
private final Runnable
private LocalAddress
private final Runnable
private LocalChannel.State
private boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LocalChannel
(LocalServerChannel parent, LocalChannel peer) -
Method Summary
Modifier and TypeMethodDescriptionconfig()
Returns the configuration of this channel.protected void
Schedule a read operation.protected void
doBind
(SocketAddress localAddress) Bind theChannel
to theSocketAddress
protected void
doClose()
Close theChannel
protected void
protected void
Disconnect thisChannel
from its remote peerprotected void
protected void
Flush the content of the given buffer to the remote peer.private void
finishPeerRead
(LocalChannel peer) private void
finishPeerRead0
(LocalChannel peer) boolean
isActive()
Returntrue
if theChannel
is active and so connected.protected boolean
isCompatible
(EventLoop loop) Returntrue
if the givenEventLoop
is compatible with this instance.boolean
isOpen()
Returnstrue
if theChannel
is open and may get active laterReturns the local address where this channel is bound to.protected SocketAddress
Returns theSocketAddress
which is bound locally.metadata()
protected AbstractChannel.AbstractUnsafe
Create a newAbstractChannel.AbstractUnsafe
instance which will be used for the life-time of theChannel
parent()
Returns the parent of this channel.private void
private void
Returns the remote address where this channel is connected to.protected SocketAddress
Return theSocketAddress
which theChannel
is connected to.private void
private void
tryClose
(boolean isActive) Methods inherited from class io.netty.channel.AbstractChannel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doShutdownOutput, equals, eventLoop, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, maxMessagesPerWrite, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, pipeline, read, toString, unsafe, validateFileRegion, voidPromise, write, write, writeAndFlush, writeAndFlush
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
-
Field Details
-
logger
-
FINISH_READ_FUTURE_UPDATER
-
METADATA
-
MAX_READER_STACK_DEPTH
private static final int MAX_READER_STACK_DEPTH- See Also:
-
config
-
inboundBuffer
-
readTask
-
shutdownHook
-
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:Channel
Returns the configuration of this channel. -
parent
Description copied from interface:Channel
Returns the parent of this channel.- Specified by:
parent
in interfaceChannel
- Overrides:
parent
in classAbstractChannel
- Returns:
- the parent channel.
null
if this channel does not have a parent channel.
-
localAddress
Description copied from interface:Channel
Returns the local address where this channel is bound to. The returnedSocketAddress
is supposed to be down-cast into more concrete type such asInetSocketAddress
to retrieve the detailed information.- Specified by:
localAddress
in interfaceChannel
- Overrides:
localAddress
in classAbstractChannel
- Returns:
- the local address of this channel.
null
if this channel is not bound.
-
remoteAddress
Description copied from interface:Channel
Returns the remote address where this channel is connected to. The returnedSocketAddress
is supposed to be down-cast into more concrete type such asInetSocketAddress
to retrieve the detailed information.- Specified by:
remoteAddress
in interfaceChannel
- Overrides:
remoteAddress
in classAbstractChannel
- Returns:
- the remote address of this channel.
null
if 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
public boolean isOpen()Description copied from interface:Channel
Returnstrue
if theChannel
is open and may get active later -
isActive
public boolean isActive()Description copied from interface:Channel
Returntrue
if theChannel
is active and so connected. -
newUnsafe
Description copied from class:AbstractChannel
Create a newAbstractChannel.AbstractUnsafe
instance which will be used for the life-time of theChannel
- Specified by:
newUnsafe
in classAbstractChannel
-
isCompatible
Description copied from class:AbstractChannel
Returntrue
if the givenEventLoop
is compatible with this instance.- Specified by:
isCompatible
in classAbstractChannel
-
localAddress0
Description copied from class:AbstractChannel
Returns theSocketAddress
which is bound locally.- Specified by:
localAddress0
in classAbstractChannel
-
remoteAddress0
Description copied from class:AbstractChannel
Return theSocketAddress
which theChannel
is connected to.- Specified by:
remoteAddress0
in classAbstractChannel
-
doRegister
Description copied from class:AbstractChannel
Is called after theChannel
is registered with itsEventLoop
as part of the register process. Sub-classes may override this method- Overrides:
doRegister
in classAbstractChannel
- Throws:
Exception
-
doBind
Description copied from class:AbstractChannel
Bind theChannel
to theSocketAddress
- Specified by:
doBind
in classAbstractChannel
- Throws:
Exception
-
doDisconnect
Description copied from class:AbstractChannel
Disconnect thisChannel
from its remote peer- Specified by:
doDisconnect
in classAbstractChannel
- Throws:
Exception
-
doClose
Description copied from class:AbstractChannel
Close theChannel
- Specified by:
doClose
in classAbstractChannel
- Throws:
Exception
-
tryClose
private void tryClose(boolean isActive) -
doDeregister
Description copied from class:AbstractChannel
- Overrides:
doDeregister
in classAbstractChannel
- Throws:
Exception
-
readInbound
private void readInbound() -
doBeginRead
Description copied from class:AbstractChannel
Schedule a read operation.- Specified by:
doBeginRead
in classAbstractChannel
- Throws:
Exception
-
doWrite
Description copied from class:AbstractChannel
Flush the content of the given buffer to the remote peer.- Specified by:
doWrite
in classAbstractChannel
- Throws:
Exception
-
finishPeerRead
-
runFinishPeerReadTask
-
releaseInboundBuffers
private void releaseInboundBuffers() -
finishPeerRead0
-