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(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 Deframer
public void setDecompressor(Decompressor decompressor)
Deframer
setDecompressor
in interface Deframer
decompressor
- the decompressing wrapper.public void setFullStreamDecompressor(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor)
Deframer
Deframer.setDecompressor(io.grpc.Decompressor)
.setFullStreamDecompressor
in interface Deframer
fullStreamDecompressor
- the decompressing wrapperpublic void request(int numMessages)
Deframer
If Deframer.close()
has been called, this method will have no effect.
public void deframe(ReadableBuffer data)
Deframer
public void closeWhenComplete()
Deframer
closeWhenComplete
in interface Deframer
public void close()
Deframer
public void bytesRead(int numBytes)
MessageDeframer.Listener
bytesRead
in interface MessageDeframer.Listener
numBytes
- the number of bytes read from the deframer's input source.public void messagesAvailable(StreamListener.MessageProducer producer)
MessageDeframer.Listener
messagesAvailable
in interface MessageDeframer.Listener
producer
- single message producer wrapping the message.public void deframerClosed(boolean hasPartialMessage)
MessageDeframer.Listener
deframerClosed
in interface MessageDeframer.Listener
hasPartialMessage
- whether the deframer contained an incomplete message at closing.public void deframeFailed(Throwable cause)
MessageDeframer.Listener
MessageDeframer.deframe(ReadableBuffer)
operation failed.deframeFailed
in interface MessageDeframer.Listener
cause
- the actual failure