abstract class AbstractHttp2StreamChannel extends AbstractChannel
Channel
of another channel, for use for modeling streams as channels.Modifier and Type | Class and Description |
---|---|
private class |
AbstractHttp2StreamChannel.Unsafe |
AbstractChannel.AbstractUnsafe
Modifier and Type | Field and Description |
---|---|
private static int |
ARBITRARY_MESSAGE_SIZE
Number of bytes to consider non-payload messages, to determine when to stop reading.
|
protected static java.lang.Object |
CLOSE_MESSAGE
Used by subclasses to queue a close channel within the read queue.
|
private boolean |
closed |
private static java.nio.channels.ClosedChannelException |
CLOSED_CHANNEL_EXCEPTION |
private ChannelConfig |
config |
private java.lang.Runnable |
fireChildReadCompleteTask |
private java.util.Queue<java.lang.Object> |
inboundBuffer |
private static ChannelMetadata |
METADATA |
private boolean |
readInProgress |
private int |
streamId |
Modifier | Constructor and Description |
---|---|
protected |
AbstractHttp2StreamChannel(Channel parent) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
bytesConsumed(int bytes)
bytes -count of bytes provided to fireChildRead(java.lang.Object) have been read. |
ChannelConfig |
config()
Returns the configuration of this channel.
|
protected void |
doBeginRead()
Schedule a read operation.
|
protected void |
doBind(java.net.SocketAddress localAddress)
Bind the
Channel to the SocketAddress |
protected void |
doClose()
Close the
Channel |
protected void |
doDisconnect()
Disconnect this
Channel from its remote peer |
private boolean |
doRead0(java.lang.Object msg,
RecvByteBufAllocator.Handle allocHandle)
Returns whether reads should continue.
|
protected void |
doWrite(ChannelOutboundBuffer in)
Flush the content of the given buffer to the remote peer.
|
protected abstract void |
doWrite(java.lang.Object msg)
Process a single write.
|
protected abstract void |
doWriteComplete()
Process end of batch of
doWrite(ChannelOutboundBuffer) s. |
protected void |
fireChildRead(java.lang.Object msg)
Receive a read message.
|
private void |
fireChildRead0(java.lang.Object msg) |
protected void |
fireChildReadComplete() |
boolean |
isActive()
Return
true if the Channel is active and so connected. |
protected boolean |
isCompatible(EventLoop loop)
Return
true if the given EventLoop is compatible with this instance. |
boolean |
isOpen()
Returns
true if the Channel is open and may get active later |
protected java.net.SocketAddress |
localAddress0()
Returns the
SocketAddress which is bound locally. |
ChannelMetadata |
metadata()
|
protected AbstractChannel.AbstractUnsafe |
newUnsafe()
Create a new
AbstractChannel.AbstractUnsafe instance which will be used for the life-time of the Channel |
protected abstract EventExecutor |
preferredEventExecutor()
The ideal thread for events like
doWrite(ChannelOutboundBuffer) to be processed on. |
protected java.net.SocketAddress |
remoteAddress0()
Return the
SocketAddress which the Channel is connected to. |
protected int |
streamId() |
protected void |
streamId(int streamId)
This method must only be called within the parent channel's eventloop.
|
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doDeregister, doRegister, equals, eventLoop, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, toString, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlush
attr, hasAttr
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
attr, hasAttr
protected static final java.lang.Object CLOSE_MESSAGE
channelRead()
. Additional inbound messages must not arrive after this one.private static final ChannelMetadata METADATA
private static final java.nio.channels.ClosedChannelException CLOSED_CHANNEL_EXCEPTION
private static final int ARBITRARY_MESSAGE_SIZE
private final ChannelConfig config
private final java.util.Queue<java.lang.Object> inboundBuffer
private final java.lang.Runnable fireChildReadCompleteTask
private volatile int streamId
private boolean closed
private boolean readInProgress
protected AbstractHttp2StreamChannel(Channel parent)
public ChannelMetadata metadata()
Channel
public ChannelConfig config()
Channel
public boolean isOpen()
Channel
true
if the Channel
is open and may get active laterpublic boolean isActive()
Channel
true
if the Channel
is active and so connected.protected AbstractChannel.AbstractUnsafe newUnsafe()
AbstractChannel
AbstractChannel.AbstractUnsafe
instance which will be used for the life-time of the Channel
newUnsafe
in class AbstractChannel
protected boolean isCompatible(EventLoop loop)
AbstractChannel
true
if the given EventLoop
is compatible with this instance.isCompatible
in class AbstractChannel
protected java.net.SocketAddress localAddress0()
AbstractChannel
SocketAddress
which is bound locally.localAddress0
in class AbstractChannel
protected java.net.SocketAddress remoteAddress0()
AbstractChannel
SocketAddress
which the Channel
is connected to.remoteAddress0
in class AbstractChannel
protected void doBind(java.net.SocketAddress localAddress) throws java.lang.Exception
AbstractChannel
Channel
to the SocketAddress
doBind
in class AbstractChannel
java.lang.Exception
protected void doDisconnect() throws java.lang.Exception
AbstractChannel
Channel
from its remote peerdoDisconnect
in class AbstractChannel
java.lang.Exception
protected void doClose() throws java.lang.Exception
AbstractChannel
Channel
doClose
in class AbstractChannel
java.lang.Exception
protected void doBeginRead()
AbstractChannel
doBeginRead
in class AbstractChannel
protected final void doWrite(ChannelOutboundBuffer in) throws java.lang.Exception
AbstractChannel
doWrite
in class AbstractChannel
java.lang.Exception
protected abstract void doWrite(java.lang.Object msg) throws java.lang.Exception
doWriteComplete()
,
which denotes the end of the batch of writes. May be called from any thread.java.lang.Exception
protected abstract void doWriteComplete()
doWrite(ChannelOutboundBuffer)
s. May be called from any thread.protected abstract EventExecutor preferredEventExecutor()
doWrite(ChannelOutboundBuffer)
to be processed on. May be used for
efficient batching, but not required.protected abstract void bytesConsumed(int bytes)
bytes
-count of bytes provided to fireChildRead(java.lang.Object)
have been read. May be called
from any thread. Must not throw an exception.protected void fireChildRead(java.lang.Object msg)
private void fireChildRead0(java.lang.Object msg)
protected void fireChildReadComplete()
protected void streamId(int streamId)
protected int streamId()
private boolean doRead0(java.lang.Object msg, RecvByteBufAllocator.Handle allocHandle)