public abstract static class ClientInterceptors.CheckedForwardingClientCall<ReqT,RespT> extends ForwardingClientCall<ReqT,RespT>
ForwardingClientCall
that 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., IllegalStateException
. CheckedForwardingClientCall
provides checkedStart()
in which throwing exceptions is
allowed.
ForwardingClientCall.SimpleForwardingClientCall<ReqT,RespT>
ClientCall.Listener<T>
Modifier | Constructor and Description |
---|---|
protected |
CheckedForwardingClientCall(ClientCall<ReqT,RespT> delegate) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
checkedStart(ClientCall.Listener<RespT> responseListener,
Metadata headers)
Subclasses implement the start logic here that would normally belong to
start() . |
protected ClientCall<ReqT,RespT> |
delegate()
Returns the delegated
ClientCall . |
void |
start(ClientCall.Listener<RespT> responseListener,
Metadata headers)
Start a call, using
responseListener for processing response messages. |
cancel, halfClose, isReady, request, sendMessage, setMessageCompression
protected CheckedForwardingClientCall(ClientCall<ReqT,RespT> delegate)
protected abstract void checkedStart(ClientCall.Listener<RespT> responseListener, Metadata headers) throws Exception
start()
.
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.
Exception
protected final ClientCall<ReqT,RespT> delegate()
ForwardingClientCall
ClientCall
.delegate
in class ForwardingClientCall<ReqT,RespT>
public final void start(ClientCall.Listener<RespT> responseListener, Metadata headers)
ClientCall
responseListener
for 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. Since Metadata
is not thread-safe, the caller must not
access headers
after this point.
start
in class ForwardingClientCall<ReqT,RespT>
responseListener
- receives response messagesheaders
- which can contain extra call metadata, e.g. authentication credentials.