Class ApplicationThreadDeframer
java.lang.Object
io.grpc.internal.ApplicationThreadDeframer
- All Implemented Interfaces:
Deframer
Sits between
AbstractStream.TransportState and MessageDeframer to deframe in the
client thread. Calls from the transport to the deframer are wrapped into an ApplicationThreadDeframer.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 ApplicationThreadDeframerListener.TransportExecutor.runOnTransportThread(Runnable) to run on the transport thread.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprivate class(package private) static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ApplicationThreadDeframerListenerprivate final MessageDeframerprivate final MessageDeframer.Listener -
Constructor Summary
ConstructorsConstructorDescriptionApplicationThreadDeframer(MessageDeframer.Listener listener, ApplicationThreadDeframer.TransportExecutor transportExecutor, MessageDeframer deframer) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this deframer and frees any resources.voidClose when any messages currently queued have been requested and delivered.voiddeframe(ReadableBuffer data) Adds the given data to this deframer and attempts delivery to the listener.(package private) MessageDeframer.Listenervoidrequest(int numMessages) Requests up to the given number of messages from the call.voidsetDecompressor(Decompressor decompressor) Sets the decompressor available to use.voidsetFullStreamDecompressor(GzipInflatingBuffer fullStreamDecompressor) Sets the decompressor used for full-stream decompression.voidsetMaxInboundMessageSize(int messageSize)
-
Field Details
-
storedListener
-
appListener
-
deframer
-
-
Constructor Details
-
ApplicationThreadDeframer
ApplicationThreadDeframer(MessageDeframer.Listener listener, ApplicationThreadDeframer.TransportExecutor transportExecutor, MessageDeframer deframer)
-
-
Method Details
-
setMaxInboundMessageSize
public void setMaxInboundMessageSize(int messageSize) - Specified by:
setMaxInboundMessageSizein interfaceDeframer
-
setDecompressor
Description copied from interface:DeframerSets the decompressor available to use. The message encoding for the stream comes later in time, and thus will not be available at the time of construction. This should only be set once, since the compression codec cannot change after the headers have been sent.- Specified by:
setDecompressorin interfaceDeframer- Parameters:
decompressor- the decompressing wrapper.
-
setFullStreamDecompressor
Description copied from interface:DeframerSets the decompressor used for full-stream decompression. Full-stream decompression disables any per-message decompressor set byDeframer.setDecompressor(Decompressor).- Specified by:
setFullStreamDecompressorin interfaceDeframer- Parameters:
fullStreamDecompressor- the decompressing wrapper
-
request
public void request(int numMessages) Description copied from interface:DeframerRequests up to the given number of messages from the call. No additional messages will be delivered.If
Deframer.close()has been called, this method will have no effect. -
deframe
Description copied from interface:DeframerAdds the given data to this deframer and attempts delivery to the listener. -
closeWhenComplete
public void closeWhenComplete()Description copied from interface:DeframerClose when any messages currently queued have been requested and delivered.- Specified by:
closeWhenCompletein interfaceDeframer
-
close
-
getAppListener
MessageDeframer.Listener getAppListener()
-