GeezerVison is showing netty.io — AbstractChannel (Netty API Reference (4.1.141.Final))
Class AbstractChannel
- All Implemented Interfaces:
Channel, ChannelOutboundInvoker, AttributeMap, Comparable<Channel>
- Direct Known Subclasses:
AbstractEpollServerChannel, AbstractEpollStreamChannel, AbstractKQueueServerChannel, AbstractKQueueStreamChannel, AbstractNioChannel, AbstractOioChannel, AbstractServerChannel, EmbeddedChannel, EpollDatagramChannel, EpollDomainDatagramChannel, KQueueDatagramChannel, KQueueDomainDatagramChannel, LocalChannel
-
Nested Class Summary
Nested Classes
Modifier and Type
Class
Description
protected class
Nested classes/interfaces inherited from interface Channel
Channel.Unsafe
Modifier and Type
Interface
Description
static interface
Unsafe operations that should never be called from user-code.
-
Constructor Summary
Constructors
Modifier
Constructor
Description
protected
protected
-
Method Summary
Modifier and Type
Method
Description
Request to bind to the given SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error.
Request to bind to the given SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error.
long
long
Request to close the Channel and notify the ChannelFuture once the operation completes,
either because the operation was successful or because of
an error.
Request to close the Channel and notify the ChannelFuture once the operation completes,
either because the operation was successful or because of
an error.
Returns the ChannelFuture which will be notified when this
channel is closed.
final int
Request to connect to the given SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error.
Request to connect to the given SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error.
Request to connect to the given SocketAddress while bind to the localAddress and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error.
Request to connect to the given SocketAddress while bind to the localAddress and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error.
Request to deregister from the previous assigned EventExecutor and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error.
Request to deregister from the previous assigned EventExecutor and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error.
Request to disconnect from the remote peer and notify the ChannelFuture once the operation completes,
either because the operation was successful or because of an error.
Request to disconnect from the remote peer and notify the ChannelFuture once the operation completes,
either because the operation was successful or because of an error.
protected abstract void
Schedule a read operation.
protected abstract void
protected abstract void
protected void
protected abstract void
Disconnect this Channel from its remote peer
protected void
Is called after the Channel is registered with its EventLoop as part of the register process.
protected void
Called when conditions justify shutting down the output portion of the channel.
protected abstract void
Flush the content of the given buffer to the remote peer.
final boolean
Returns true if and only if the specified object is identical
with this channel (i.e: this == o).
Returns the underlying FileChannel, or null if the region is not open.
Request to flush all pending messages via this ChannelOutboundInvoker.
final int
Returns the ID of this channel.
Returns the globally unique identifier of this Channel.
protected void
Deprecated.
no use-case for this.
protected void
Deprecated.
no use-case for this.
protected abstract boolean
Return true if the given EventLoop is compatible with this instance.
boolean
boolean
Returns true if and only if the I/O thread will perform the
requested write operation immediately.
Returns the local address where this channel is bound to.
protected final int
Returns the parent of this channel.
Returns the remote address where this channel is connected to.
Returns the String representation of this channel.
Returns an internal-use-only object that provides unsafe operations.
protected void
Return a special ChannelPromise which can be reused for different operations.
attr, hasAttr
Modifier and Type
Method
Description
<T> boolean
Methods inherited from interface Channel
config, isActive, isOpen, metadata
Modifier and Type
Method
Description
Returns the configuration of this channel.
boolean
Return true if the Channel is active and so connected.
boolean
Returns true if the Channel is open and may get active later
-
Constructor Details
-
AbstractChannel
protected AbstractChannel(Channel parent)
Creates a new instance.
- Parameters:
parent - the parent of this channel. null if there's no parent.
-
AbstractChannel
Creates a new instance.
- Parameters:
parent - the parent of this channel. null if there's no parent.
-
Method Details
-
maxMessagesPerWrite
protected final int maxMessagesPerWrite()
-
id
Description copied from interface: Channel
Returns the globally unique identifier of this Channel.
- Specified by:
id in interface Channel
-
-
-
isWritable
public boolean isWritable()
Description copied from interface: Channel
Returns true if and only if the I/O thread will perform the
requested write operation immediately. Any write requests made when
this method returns false are queued until the I/O thread is
ready to process the queued write requests.
WriteBufferWaterMark can be used to configure on which condition
the write buffer would cause this channel to change writability.
- Specified by:
isWritable in interface Channel
-
-
-
parent
Description copied from interface: Channel
Returns the parent of this channel.
- Specified by:
parent in interface Channel
- 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 returned
SocketAddress is supposed to be down-cast into more concrete
type such as InetSocketAddress to retrieve the detailed
information.
- Specified by:
localAddress in interface Channel
- Returns:
- the local address of this channel.
null if this channel is not bound.
-
invalidateLocalAddress
Deprecated.
no use-case for this.
-
remoteAddress
Description copied from interface: Channel
Returns the remote address where this channel is connected to. The
returned SocketAddress is supposed to be down-cast into more
concrete type such as InetSocketAddress to retrieve the detailed
information.
- Specified by:
remoteAddress in interface Channel
- 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,
use DefaultAddressedEnvelope.recipient() to determine
the origination of the received message as this method will
return null.
-
invalidateRemoteAddress
Deprecated.
no use-case for this.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
closeFuture
Description copied from interface: Channel
Returns the ChannelFuture which will be notified when this
channel is closed. This method always returns the same future instance.
- Specified by:
closeFuture in interface Channel
-
unsafe
Description copied from interface: Channel
Returns an internal-use-only object that provides unsafe operations.
- Specified by:
unsafe in interface Channel
-
-
hashCode
public final int hashCode()
Returns the ID of this channel.
- Overrides:
hashCode in class Object
-
equals
public final boolean equals(Object o)
Returns true if and only if the specified object is identical
with this channel (i.e: this == o).
- Overrides:
equals in class Object
-
-
-
-
isCompatible
protected abstract boolean isCompatible(EventLoop loop)
Return true if the given EventLoop is compatible with this instance.
-
-
-
doRegister
Is called after the Channel is registered with its EventLoop as part of the register process.
Sub-classes may override this method
- Throws:
Exception
-
-
-
-
doShutdownOutput
protected void doShutdownOutput()
throws Exception
Called when conditions justify shutting down the output portion of the channel. This may happen if a write
operation throws an exception.
- Throws:
Exception
-
-
doBeginRead
protected abstract void doBeginRead()
throws Exception
Schedule a read operation.
- Throws:
Exception
-
doWrite
Flush the content of the given buffer to the remote peer.
- Throws:
Exception
-
-
-
fileChannel
Returns the underlying FileChannel, or null if the region is not open.
This method does not open the region.
|