public abstract class AbstractNioChannel extends AbstractChannel
Channel
implementations which use a Selector based approach.Modifier and Type | Class and Description |
---|---|
protected class |
AbstractNioChannel.AbstractNioUnsafe |
static interface |
AbstractNioChannel.NioUnsafe
Special
Unsafe sub-type which allows to access the underlying SelectableChannel |
AbstractChannel.AbstractUnsafe
Channel.Unsafe
Modifier and Type | Field and Description |
---|---|
protected int |
readInterestOp |
Modifier | Constructor and Description |
---|---|
protected |
AbstractNioChannel(Channel parent,
SelectableChannel ch,
int readInterestOp)
Create a new instance
|
Modifier and Type | Method and Description |
---|---|
protected void |
doBeginRead()
Schedule a read operation.
|
protected abstract boolean |
doConnect(SocketAddress remoteAddress,
SocketAddress localAddress)
Connect to the remote peer
|
protected void |
doDeregister()
|
protected abstract void |
doFinishConnect()
Finish the connect
|
protected void |
doRegister()
|
protected boolean |
isCompatible(EventLoop loop)
Return
true if the given EventLoop is compatible with this instance. |
protected boolean |
isInputShutdown()
Return
true if the input of this Channel is shutdown |
boolean |
isOpen()
Returns
true if the Channel is open an may get active later |
protected boolean |
isReadPending() |
protected SelectableChannel |
javaChannel() |
protected ByteBuf |
newDirectBuffer(ByteBuf buf)
Returns an off-heap copy of the specified
ByteBuf , and releases the original one. |
protected ByteBuf |
newDirectBuffer(ReferenceCounted holder,
ByteBuf buf)
Returns an off-heap copy of the specified
ByteBuf , and releases the specified holder. |
protected SelectionKey |
selectionKey()
Return the current
SelectionKey |
protected void |
setReadPending(boolean readPending) |
AbstractNioChannel.NioUnsafe |
unsafe()
Returns an internal-use-only object that provides unsafe operations.
|
alloc, bind, bind, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doBind, doClose, doDisconnect, doWrite, equals, eventLoop, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, localAddress0, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newUnsafe, parent, pipeline, read, remoteAddress, remoteAddress0, toString, voidPromise, write, write, writeAndFlush, writeAndFlush
attr, hasAttr
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
attr, hasAttr
protected AbstractNioChannel(Channel parent, SelectableChannel ch, int readInterestOp)
parent
- the parent Channel
by which this instance was created. May be null
ch
- the underlying SelectableChannel
on which it operatesreadInterestOp
- the ops to set to receive data from the SelectableChannel
public boolean isOpen()
Channel
true
if the Channel
is open an may get active laterpublic AbstractNioChannel.NioUnsafe unsafe()
Channel
unsafe
in interface Channel
unsafe
in class AbstractChannel
protected SelectableChannel javaChannel()
protected SelectionKey selectionKey()
SelectionKey
protected boolean isReadPending()
protected void setReadPending(boolean readPending)
protected boolean isInputShutdown()
true
if the input of this Channel
is shutdownprotected boolean isCompatible(EventLoop loop)
AbstractChannel
true
if the given EventLoop
is compatible with this instance.isCompatible
in class AbstractChannel
protected void doRegister() throws Exception
AbstractChannel
Channel
is registered with its EventLoop
as part of the register process.
Sub-classes may override this methoddoRegister
in class AbstractChannel
Exception
protected void doDeregister() throws Exception
AbstractChannel
doDeregister
in class AbstractChannel
Exception
protected void doBeginRead() throws Exception
AbstractChannel
doBeginRead
in class AbstractChannel
Exception
protected abstract boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception
Exception
protected abstract void doFinishConnect() throws Exception
Exception
protected final ByteBuf newDirectBuffer(ReferenceCounted holder, ByteBuf buf)
ByteBuf
, and releases the specified holder.
The caller must ensure that the holder releases the original ByteBuf
when the holder is released by
this method. Note that this method does not create an off-heap copy if the allocation / deallocation cost is
too high, but just returns the original ByteBuf
..Copyright © 2008–2015 The Netty Project. All rights reserved.