public class ApplicationThreadDeframer extends Object implements Deframer, MessageDeframer.Listener
AbstractStream.TransportState and MessageDeframer to deframe in the
client thread. Calls from the transport to the deframer are wrapped into an InitializingMessageProducer and given back to the transport, where they will be run on the
client thread. Calls from the deframer back to the transport use TransportExecutor#runOnTransportThread to run on the transport thread.| Modifier and Type | Method and Description |
|---|---|
void |
bytesRead(int numBytes)
Called when the given number of bytes has been read from the input source of the deframer.
|
void |
close()
Closes this deframer and frees any resources.
|
void |
closeWhenComplete()
Close when any messages currently queued have been requested and delivered.
|
void |
deframe(ReadableBuffer data)
Adds the given data to this deframer and attempts delivery to the listener.
|
void |
deframeFailed(Throwable cause)
Called when a
MessageDeframer.deframe(ReadableBuffer) operation failed. |
void |
deframerClosed(boolean hasPartialMessage)
Called when the deframer closes.
|
void |
messagesAvailable(StreamListener.MessageProducer producer)
Called to deliver the next complete message.
|
void |
request(int numMessages)
Requests up to the given number of messages from the call.
|
void |
setDecompressor(io.grpc.Decompressor decompressor)
Sets the decompressor available to use.
|
void |
setFullStreamDecompressor(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor)
Sets the decompressor used for full-stream decompression.
|
void |
setMaxInboundMessageSize(int messageSize) |
public void setMaxInboundMessageSize(int messageSize)
setMaxInboundMessageSize in interface Deframerpublic void setDecompressor(io.grpc.Decompressor decompressor)
DeframersetDecompressor in interface Deframerdecompressor - the decompressing wrapper.public void setFullStreamDecompressor(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor)
DeframerDeframer.setDecompressor(io.grpc.Decompressor).setFullStreamDecompressor in interface DeframerfullStreamDecompressor - the decompressing wrapperpublic void request(int numMessages)
DeframerIf Deframer.close() has been called, this method will have no effect.
public void deframe(ReadableBuffer data)
Deframerpublic void closeWhenComplete()
DeframercloseWhenComplete in interface Deframerpublic void close()
Deframerpublic void bytesRead(int numBytes)
MessageDeframer.ListenerbytesRead in interface MessageDeframer.ListenernumBytes - the number of bytes read from the deframer's input source.public void messagesAvailable(StreamListener.MessageProducer producer)
MessageDeframer.ListenermessagesAvailable in interface MessageDeframer.Listenerproducer - single message producer wrapping the message.public void deframerClosed(boolean hasPartialMessage)
MessageDeframer.ListenerdeframerClosed in interface MessageDeframer.ListenerhasPartialMessage - whether the deframer contained an incomplete message at closing.public void deframeFailed(Throwable cause)
MessageDeframer.ListenerMessageDeframer.deframe(ReadableBuffer) operation failed.deframeFailed in interface MessageDeframer.Listenercause - the actual failure