Top Description Inners Fields Constructors Methods
io.netty.channel

public abstract Class AbstractChannel

extends DefaultAttributeMap
implements Channel
Class Inheritance
All Implemented Interfaces
io.netty.channel.Channel, java.lang.Comparable, io.netty.channel.ChannelOutboundInvoker, io.netty.util.AttributeMap
Known Direct Subclasses
io.netty.channel.AbstractServerChannel, io.netty.channel.local.LocalChannel, io.netty.channel.nio.AbstractNioChannel, io.netty.channel.oio.AbstractOioChannel, io.netty.channel.embedded.EmbeddedChannel, io.netty.bootstrap.FailedChannel
Imports
io.netty.buffer.ByteBufAllocator, io.netty.channel.socket.ChannelOutputShutdownEvent, .ChannelOutputShutdownException, io.netty.util.DefaultAttributeMap, .ReferenceCountUtil, io.netty.util.internal.ObjectUtil, .PlatformDependent, .UnstableApi, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.io.IOException, java.net.ConnectException, .InetSocketAddress, .NoRouteToHostException, .SocketAddress, .SocketException, java.nio.channels.ClosedChannelException, .NotYetConnectedException, java.util.concurrent.Executor, .RejectedExecutionException

A skeletal Channel implementation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract class
AbstractChannel.AbstractUnsafe

Unsafe implementation which sub-classes must extend and use.

private static class
private static class
private static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final AbstractChannel.CloseFuture
private boolean
private volatile EventLoop
private final ChannelId
private Throwable
private volatile SocketAddress
private static final InternalLogger
private final Channel
private final DefaultChannelPipeline
private volatile boolean
private volatile SocketAddress
private String
private boolean
strValActive

Cache for the string representation of this channel

private final Channel.Unsafe
private final VoidChannelPromise

Constructor Summary

AccessConstructor and Description
protected
AbstractChannel(Channel
the parent of this channel. null if there's no parent.
parent
)

Creates a new instance.

protected
AbstractChannel(Channel
the parent of this channel. null if there's no parent.
parent
,
ChannelId id)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
public ByteBufAllocator
alloc()

Implements io.netty.channel.Channel.alloc.

Return the assigned ByteBufAllocator which will be used to allocate ByteBufs.
public ChannelFuture
bind(SocketAddress localAddress)

Implements io.netty.channel.ChannelOutboundInvoker.bind.

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.
public ChannelFuture
bind(SocketAddress localAddress, ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.bind.

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.
public long
bytesBeforeUnwritable()

Implements io.netty.channel.Channel.bytesBeforeUnwritable.

Get how many bytes can be written until isWritable() returns false.
public long
bytesBeforeWritable()

Implements io.netty.channel.Channel.bytesBeforeWritable.

Get how many bytes must be drained from underlying buffers until isWritable() returns true.
public ChannelFuture
close()

Implements io.netty.channel.ChannelOutboundInvoker.close.

Request to close the Channel and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public ChannelFuture
close(ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.close.

Request to close the Channel and notify the ChannelFuture once the operation completes, either because the operation was successful or because of an error.
public ChannelFuture
closeFuture()

Implements io.netty.channel.Channel.closeFuture.

Returns the ChannelFuture which will be notified when this channel is closed.
public final int
compareTo(Channel
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public ChannelFuture
connect(SocketAddress remoteAddress)

Implements io.netty.channel.ChannelOutboundInvoker.connect.

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.
public ChannelFuture
connect(SocketAddress remoteAddress, SocketAddress localAddress)

Implements io.netty.channel.ChannelOutboundInvoker.connect.

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.
public ChannelFuture
connect(SocketAddress remoteAddress, ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.connect.

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.
public ChannelFuture
connect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.connect.

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.
public ChannelFuture
deregister()

Implements io.netty.channel.ChannelOutboundInvoker.deregister.

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.
public ChannelFuture
deregister(ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.deregister.

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.
public ChannelFuture
disconnect()

Implements io.netty.channel.ChannelOutboundInvoker.disconnect.

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.
public ChannelFuture
disconnect(ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.disconnect.

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
doBeginRead()

Schedule a read operation.

protected abstract void
doBind(SocketAddress localAddress)

Bind the Channel to the SocketAddress

protected abstract void
doClose()

Close the Channel

protected void
doDeregister()

Deregister the Channel from its EventLoop.

protected abstract void
doDisconnect()

Disconnect this Channel from its remote peer

protected void
doRegister()

Is called after the Channel is registered with its EventLoop as part of the register process.

protected void
doShutdownOutput()

Called when conditions justify shutting down the output portion of the channel.

protected abstract void
doWrite(ChannelOutboundBuffer in)

Flush the content of the given buffer to the remote peer.

public final boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Returns true if and only if the specified object is identical with this channel (i.e: this == o).
public EventLoop
eventLoop()

Implements io.netty.channel.Channel.eventLoop.

Return the EventLoop this Channel was registered to.
protected Object
filterOutboundMessage(Object msg)

Invoked when a new message is added to a ChannelOutboundBuffer of this AbstractChannel, so that the Channel implementation converts the message to another.

public Channel
flush()

Implements io.netty.channel.Channel.flush.

Request to flush all pending messages via this ChannelOutboundInvoker.
public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns the ID of this channel.
public final ChannelId
id()

Implements io.netty.channel.Channel.id.

Returns the globally unique identifier of this Channel.
protected void
invalidateLocalAddress()

Deprecated no use-case for this.
protected void
invalidateRemoteAddress()

Deprecated no use-case for this.
protected abstract boolean
isCompatible(EventLoop loop)

Return true if the given EventLoop is compatible with this instance.

public boolean
isRegistered()

Implements io.netty.channel.Channel.isRegistered.

Returns true if the Channel is registered with an EventLoop.
public boolean
isWritable()

Implements io.netty.channel.Channel.isWritable.

Returns true if and only if the I/O thread will perform the requested write operation immediately.
public SocketAddress
localAddress()

Implements io.netty.channel.Channel.localAddress.

Returns the local address where this channel is bound to.
protected abstract SocketAddress
localAddress0()

Returns the SocketAddress which is bound locally.

protected final int
protected DefaultChannelPipeline
newChannelPipeline()

Returns a new DefaultChannelPipeline instance.

public ChannelFuture
newFailedFuture(Throwable cause)

Implements io.netty.channel.ChannelOutboundInvoker.newFailedFuture.

Create a new ChannelFuture which is marked as failed already.
protected ChannelId
newId()

Returns a new DefaultChannelId instance.

public ChannelProgressivePromise
public ChannelPromise
public ChannelFuture
newSucceededFuture()

Implements io.netty.channel.ChannelOutboundInvoker.newSucceededFuture.

Create a new ChannelFuture which is marked as succeeded already.
protected abstract AbstractChannel.AbstractUnsafe
newUnsafe()

Create a new AbstractUnsafe instance which will be used for the life-time of the Channel

public Channel
parent()

Implements io.netty.channel.Channel.parent.

Returns the parent of this channel.
public ChannelPipeline
public Channel
read()

Implements io.netty.channel.Channel.read.

Request to Read data from the Channel into the first inbound buffer, triggers an ChannelInboundHandler#channelRead(ChannelHandlerContext, Object) event if data was read, and triggers a channelReadComplete event so the handler can decide to continue reading.
public SocketAddress
remoteAddress()

Implements io.netty.channel.Channel.remoteAddress.

Returns the remote address where this channel is connected to.
protected abstract SocketAddress
remoteAddress0()

Return the SocketAddress which the Channel is connected to.

public String
toString()

Overrides java.lang.Object.toString.

Returns the String representation of this channel.
public Channel.Unsafe
unsafe()

Implements io.netty.channel.Channel.unsafe.

Returns an internal-use-only object that provides unsafe operations.
protected void
validateFileRegion(DefaultFileRegion region, long position)

public final ChannelPromise
voidPromise()

Implements io.netty.channel.ChannelOutboundInvoker.voidPromise.

Return a special ChannelPromise which can be reused for different operations.
public ChannelFuture
write(Object msg)

Implements io.netty.channel.ChannelOutboundInvoker.write.

Request to write a message via this ChannelHandlerContext through the ChannelPipeline.
public ChannelFuture
write(Object msg, ChannelPromise promise)

Implements io.netty.channel.ChannelOutboundInvoker.write.

Request to write a message via this ChannelHandlerContext through the ChannelPipeline.
public ChannelFuture
public ChannelFuture
Inherited from io.netty.util.DefaultAttributeMap:
attrhasAttr