public abstract static class AbstractStream.TransportState extends Object implements MessageDeframer.Listener
AbstractStream
).Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ONREADY_THRESHOLD
The default number of queued bytes for a given stream, below which
StreamListener.onReady() will be called. |
Modifier | Constructor and Description |
---|---|
protected |
TransportState(int maxMessageSize,
StatsTraceContext statsTraceCtx,
TransportTracer transportTracer) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeDeframer(boolean stopDelivery)
Closes the deframer and frees any resources.
|
protected void |
deframe(ReadableBuffer frame)
Called to parse a received frame and attempt delivery of any completed messages.
|
StatsTraceContext |
getStatsTraceContext() |
protected TransportTracer |
getTransportTracer() |
protected abstract StreamListener |
listener()
Override this method to provide a stream listener.
|
void |
messagesAvailable(StreamListener.MessageProducer producer)
Called to deliver the next complete message.
|
void |
onSentBytes(int numBytes)
Event handler to be called by the subclass when a number of bytes has been sent to the remote
endpoint.
|
protected void |
onStreamAllocated()
Event handler to be called by the subclass when the stream's headers have passed any
connection flow control (i.e., MAX_CONCURRENT_STREAMS).
|
protected void |
onStreamDeallocated()
Notify that the stream does not exist in a usable state any longer.
|
void |
requestMessagesFromDeframer(int numMessages)
Called to request the given number of messages from the deframer.
|
void |
runOnTransportThread(Runnable r) |
protected void |
setDecompressor(Decompressor decompressor) |
protected void |
setFullStreamDecompressor(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bytesRead, deframeFailed, deframerClosed
public static final int DEFAULT_ONREADY_THRESHOLD
StreamListener.onReady()
will be called.protected TransportState(int maxMessageSize, StatsTraceContext statsTraceCtx, TransportTracer transportTracer)
protected void setFullStreamDecompressor(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor)
protected abstract StreamListener listener()
public void messagesAvailable(StreamListener.MessageProducer producer)
MessageDeframer.Listener
messagesAvailable
in interface MessageDeframer.Listener
producer
- single message producer wrapping the message.protected final void closeDeframer(boolean stopDelivery)
When stopDelivery
is false, the deframer will wait to close until any already
queued messages have been delivered.
The deframer will invoke ApplicationThreadDeframer.deframerClosed(boolean)
upon closing.
stopDelivery
- interrupt pending deliveries and close immediatelyprotected final void deframe(ReadableBuffer frame)
public final void requestMessagesFromDeframer(int numMessages)
public final StatsTraceContext getStatsTraceContext()
protected final void setDecompressor(Decompressor decompressor)
protected void onStreamAllocated()
StreamListener.onReady()
handler if appropriate. This must be called from the transport
thread, since the listener may be called back directly.protected final void onStreamDeallocated()
AbstractStream.isReady()
to return false
from this point forward.
This does not generally need to be called explicitly by the transport, as it is handled
implicitly by AbstractClientStream
and AbstractServerStream
.
public final void onSentBytes(int numBytes)
StreamListener.onReady()
handler if
appropriate. This must be called from the transport thread, since the listener may be called
back directly.numBytes
- the number of bytes that were sent.protected TransportTracer getTransportTracer()
public void runOnTransportThread(Runnable r)