Package io.grpc.internal
Class ApplicationThreadDeframer
- java.lang.Object
-
- io.grpc.internal.ApplicationThreadDeframer
-
- All Implemented Interfaces:
Deframer
public class ApplicationThreadDeframer extends java.lang.Object implements Deframer
Sits betweenAbstractStream.TransportState
andMessageDeframer
to deframe in the client thread. Calls from the transport to the deframer are wrapped into anApplicationThreadDeframer.InitializingMessageProducer
and given back to the transport, where they will be run on the client thread. Calls from the deframer back to the transport useApplicationThreadDeframerListener.TransportExecutor.runOnTransportThread(java.lang.Runnable)
to run on the transport thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ApplicationThreadDeframer.CloseableInitializingMessageProducer
private class
ApplicationThreadDeframer.InitializingMessageProducer
(package private) static interface
ApplicationThreadDeframer.TransportExecutor
-
Field Summary
Fields Modifier and Type Field Description private ApplicationThreadDeframerListener
appListener
private MessageDeframer
deframer
private MessageDeframer.Listener
storedListener
-
Constructor Summary
Constructors Constructor Description ApplicationThreadDeframer(MessageDeframer.Listener listener, ApplicationThreadDeframer.TransportExecutor transportExecutor, MessageDeframer deframer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.(package private) MessageDeframer.Listener
getAppListener()
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(GzipInflatingBuffer fullStreamDecompressor)
Sets the decompressor used for full-stream decompression.void
setMaxInboundMessageSize(int messageSize)
-
-
-
Field Detail
-
storedListener
private final MessageDeframer.Listener storedListener
-
appListener
private final ApplicationThreadDeframerListener appListener
-
deframer
private final MessageDeframer deframer
-
-
Constructor Detail
-
ApplicationThreadDeframer
ApplicationThreadDeframer(MessageDeframer.Listener listener, ApplicationThreadDeframer.TransportExecutor transportExecutor, MessageDeframer deframer)
-
-
Method Detail
-
setMaxInboundMessageSize
public void setMaxInboundMessageSize(int messageSize)
- Specified by:
setMaxInboundMessageSize
in interfaceDeframer
-
setDecompressor
public void setDecompressor(Decompressor decompressor)
Description copied from interface:Deframer
Sets 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:
setDecompressor
in interfaceDeframer
- Parameters:
decompressor
- the decompressing wrapper.
-
setFullStreamDecompressor
public void setFullStreamDecompressor(GzipInflatingBuffer fullStreamDecompressor)
Description copied from interface:Deframer
Sets the decompressor used for full-stream decompression. Full-stream decompression disables any per-message decompressor set byDeframer.setDecompressor(io.grpc.Decompressor)
.- Specified by:
setFullStreamDecompressor
in interfaceDeframer
- Parameters:
fullStreamDecompressor
- the decompressing wrapper
-
request
public void request(int numMessages)
Description copied from interface:Deframer
Requests 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
public void deframe(ReadableBuffer data)
Description copied from interface:Deframer
Adds the given data to this deframer and attempts delivery to the listener.
-
closeWhenComplete
public void closeWhenComplete()
Description copied from interface:Deframer
Close when any messages currently queued have been requested and delivered.- Specified by:
closeWhenComplete
in interfaceDeframer
-
close
public void close()
Description copied from interface:Deframer
Closes this deframer and frees any resources. After this method is called, additional calls will have no effect.
-
getAppListener
MessageDeframer.Listener getAppListener()
-
-