public abstract class AbstractChannel extends io.netty.util.DefaultAttributeMap implements Channel
Channel implementation.| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractChannel.AbstractUnsafe |
Channel.Unsafe| Modifier and Type | Field and Description |
|---|---|
protected ChannelFlushFutureNotifier |
flushFutureNotifier |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractChannel(Channel parent,
Integer id)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
ChannelFuture |
bind(SocketAddress localAddress) |
ChannelFuture |
bind(SocketAddress localAddress,
ChannelFuture future) |
ChannelFuture |
close() |
ChannelFuture |
close(ChannelFuture future) |
ChannelFuture |
closeFuture()
Returns the
ChannelFuture which will be notified when this
channel is closed. |
int |
compareTo(Channel o)
Compares the ID of the two channels.
|
ChannelFuture |
connect(SocketAddress remoteAddress) |
ChannelFuture |
connect(SocketAddress remoteAddress,
ChannelFuture future) |
ChannelFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress) |
ChannelFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
ChannelFuture future) |
ChannelFuture |
deregister() |
ChannelFuture |
deregister(ChannelFuture future) |
ChannelFuture |
disconnect() |
ChannelFuture |
disconnect(ChannelFuture future) |
protected abstract void |
doBind(SocketAddress localAddress) |
protected abstract void |
doClose() |
protected abstract void |
doDeregister() |
protected abstract void |
doDisconnect() |
protected void |
doFlushByteBuffer(io.netty.buffer.ByteBuf buf) |
protected void |
doFlushMessageBuffer(io.netty.buffer.MessageBuf<Object> buf) |
protected void |
doPreClose() |
protected abstract Runnable |
doRegister() |
boolean |
equals(Object o)
Returns
true if and only if the specified object is identical
with this channel (i.e: this == o). |
EventLoop |
eventLoop()
|
ChannelFuture |
flush() |
ChannelFuture |
flush(ChannelFuture future) |
int |
hashCode()
Returns the ID of this channel.
|
Integer |
id()
Returns the unique integer ID of this channel.
|
protected void |
invalidateLocalAddress() |
protected void |
invalidateRemoteAddress() |
protected abstract boolean |
isCompatible(EventLoop loop) |
protected abstract boolean |
isFlushPending() |
boolean |
isRegistered() |
SocketAddress |
localAddress()
Returns the local address where this channel is bound to.
|
protected abstract SocketAddress |
localAddress0() |
ChannelFuture |
newFailedFuture(Throwable cause)
Create a new
ChannelFuture which is marked as fakued already. |
ChannelFuture |
newFuture()
Create a new
ChannelFuture |
ChannelFuture |
newSucceededFuture()
Create a new
ChannelFuture which is marked as successes already. |
protected abstract Channel.Unsafe |
newUnsafe() |
io.netty.buffer.ByteBuf |
outboundByteBuffer() |
io.netty.buffer.MessageBuf<Object> |
outboundMessageBuffer() |
Channel |
parent()
Returns the parent of this channel.
|
ChannelPipeline |
pipeline()
Returns the
ChannelPipeline which handles ChannelEvents
associated with this channel. |
SocketAddress |
remoteAddress()
Returns the remote address where this channel is connected to.
|
protected abstract SocketAddress |
remoteAddress0() |
String |
toString()
Returns the
String representation of this channel. |
Channel.Unsafe |
unsafe()
Caution for transport implementations use only!
|
ChannelFuture |
write(Object message) |
ChannelFuture |
write(Object message,
ChannelFuture future) |
protected final ChannelFlushFutureNotifier flushFutureNotifier
public final Integer id()
Channelpublic Channel parent()
Channelpublic ChannelPipeline pipeline()
ChannelChannelPipeline which handles ChannelEvents
associated with this channel.public SocketAddress localAddress()
ChannelSocketAddress is supposed to be down-cast into more concrete
type such as InetSocketAddress to retrieve the detailed
information.localAddress in interface Channelnull if this channel is not bound.protected void invalidateLocalAddress()
public SocketAddress remoteAddress()
ChannelSocketAddress is supposed to be down-cast into more
concrete type such as InetSocketAddress to retrieve the detailed
information.remoteAddress in interface Channelnull 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 MessageEvent#getRemoteAddress() to determine
the origination of the received message as this method will
return null.protected void invalidateRemoteAddress()
public boolean isRegistered()
isRegistered in interface Channelpublic ChannelFuture bind(SocketAddress localAddress)
bind in interface ChannelOutboundInvokerpublic ChannelFuture connect(SocketAddress remoteAddress)
connect in interface ChannelOutboundInvokerpublic ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress)
connect in interface ChannelOutboundInvokerpublic ChannelFuture disconnect()
disconnect in interface ChannelOutboundInvokerpublic ChannelFuture close()
close in interface ChannelOutboundInvokerpublic ChannelFuture deregister()
deregister in interface ChannelOutboundInvokerpublic ChannelFuture flush()
flush in interface ChannelOutboundInvokerpublic ChannelFuture write(Object message)
write in interface ChannelOutboundInvokerpublic ChannelFuture bind(SocketAddress localAddress, ChannelFuture future)
bind in interface ChannelOutboundInvokerpublic ChannelFuture connect(SocketAddress remoteAddress, ChannelFuture future)
connect in interface ChannelOutboundInvokerpublic ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelFuture future)
connect in interface ChannelOutboundInvokerpublic ChannelFuture disconnect(ChannelFuture future)
disconnect in interface ChannelOutboundInvokerpublic ChannelFuture close(ChannelFuture future)
close in interface ChannelOutboundInvokerpublic ChannelFuture deregister(ChannelFuture future)
deregister in interface ChannelOutboundInvokerpublic io.netty.buffer.ByteBuf outboundByteBuffer()
outboundByteBuffer in interface Channelpublic io.netty.buffer.MessageBuf<Object> outboundMessageBuffer()
outboundMessageBuffer in interface Channelpublic ChannelFuture flush(ChannelFuture future)
flush in interface ChannelOutboundInvokerpublic ChannelFuture write(Object message, ChannelFuture future)
write in interface ChannelOutboundInvokerpublic ChannelFuture newFuture()
ChannelFutureFactoryChannelFuturenewFuture in interface ChannelFutureFactorypublic ChannelFuture newSucceededFuture()
ChannelFutureFactoryChannelFuture which is marked as successes already. So ChannelFuture.isSuccess()
will return true. All ChannelFutureListener added to it will be notified directly. Also
every call of blocking methods will just return without blocking.newSucceededFuture in interface ChannelFutureFactorypublic ChannelFuture newFailedFuture(Throwable cause)
ChannelFutureFactoryChannelFuture which is marked as fakued already. So ChannelFuture.isSuccess()
will return false. All ChannelFutureListener added to it will be notified directly. Also
every call of blocking methods will just return without blocking.newFailedFuture in interface ChannelFutureFactorypublic ChannelFuture closeFuture()
ChannelChannelFuture which will be notified when this
channel is closed. This method always returns the same future instance.closeFuture in interface Channelpublic Channel.Unsafe unsafe()
Channelprotected abstract Channel.Unsafe newUnsafe()
public final int hashCode()
public final boolean equals(Object o)
true if and only if the specified object is identical
with this channel (i.e: this == o).public final int compareTo(Channel o)
compareTo in interface Comparable<Channel>public String toString()
String representation of this channel. The returned
string contains the ID, local address,
and remote address of this channel for
easier identification.protected abstract boolean isCompatible(EventLoop loop)
protected abstract SocketAddress localAddress0()
protected abstract SocketAddress remoteAddress0()
protected abstract void doBind(SocketAddress localAddress) throws Exception
Exceptionprotected void doFlushByteBuffer(io.netty.buffer.ByteBuf buf)
throws Exception
Exceptionprotected void doFlushMessageBuffer(io.netty.buffer.MessageBuf<Object> buf) throws Exception
Exceptionprotected abstract boolean isFlushPending()
Copyright © 2008-2012 The Netty Project. All Rights Reserved.