public abstract static class ClientInterceptors.CheckedForwardingClientCall<ReqT,RespT> extends ForwardingClientCall<ReqT,RespT>
ForwardingClientCallthat delivers exceptions from its start logic to the call listener.
ClientCall.start(ClientCall.Listener, Metadata) should not throw any
exception other than those caused by misuse, e.g.,
checkedStart() in which throwing exceptions is
|Modifier||Constructor and Description|
|Modifier and Type||Method and Description|
Prevent any further processing for this
Subclasses implement the start logic here that would normally belong to
Returns the delegated
Returns additional properties of the call.
Close the call for request message sending.
Requests up to the given number of messages from the call to be delivered to
Enables per-message compression, if an encoding type has been negotiated.
Start a call, using
protected abstract void checkedStart(ClientCall.Listener<RespT> responseListener, Metadata headers) throws Exception
Implementation should call
this.delegate().start() in the normal path. Exceptions
may safely be thrown prior to calling
this.delegate().start(). Such exceptions will
be handled by
CheckedForwardingClientCall and be delivered to
responseListener. Exceptions must not be thrown after calling
this.delegate().start(), as this can result in
ClientCall.Listener.onClose(io.grpc.Status, io.grpc.Metadata) being
called multiple times.
protected final ClientCall<ReqT,RespT> delegate()
public final void start(ClientCall.Listener<RespT> responseListener, Metadata headers)
responseListenerfor processing response messages.
It must be called prior to any other method on this class, except for
ClientCall.cancel(java.lang.String, java.lang.Throwable) which
may be called at any time.
Metadata is not thread-safe, the caller must not access (read or write)
headers after this point.
public void request(int numMessages)
ClientCall.Listener.onMessage(Object). No additional messages will be delivered.
Message delivery is guaranteed to be sequential in the order received. In addition, the listener methods will not be accessed concurrently. While it is not guaranteed that the same thread will always be used, it is guaranteed that only a single thread will access the listener at a time.
If it is desired to bypass inbound flow control, a very large number of messages can be
If called multiple times, the number of messages able to delivered will be the sum of the calls.
This method is safe to call from multiple threads without external synchronization.
ClientCall. No further messages may be sent or will be received. The server is informed of cancellations, but may not stop processing the call. Cancellation is permitted even if previously
ClientCall.halfClose()d. Cancelling an already
ClientCallhas no effect.
No other methods on this class can be called after this method has been called.
It is recommended that at least one of the arguments to be non-
null, to provide
useful debug information. Both argument being null may log warnings and result in suboptimal
performance. Also note that the provided information will not be sent to the server.
public void halfClose()
public void setMessageCompression(boolean enabled)
public boolean isReady()
true, indicates that the call is capable of sending additional messages without requiring excessive buffering internally. This event is just a suggestion and the application is free to ignore it, however doing so may result in excessive buffering within the call.
ClientCall.Listener.onReady() will be called after
If the type of the call is either
MethodDescriptor.MethodType.SERVER_STREAMING, this method may persistently return
false. Calls that send exactly one message should not check this method.
This abstract class's implementation always returns
true. Implementations generally
override the method.
public Attributes getAttributes()
ClientCall.Listener.onClose(io.grpc.Status, io.grpc.Metadata). If called prematurely, the implementation may throw
IllegalStateExceptionor return arbitrary