public abstract static class ClientInterceptors.CheckedForwardingCall<ReqT,RespT> extends ForwardingCall<ReqT,RespT>
ForwardingCall
that delivers exceptions from its start logic to the call
listener.
Call.start(Call.Listener, Metadata.Headers)
should not throw any exception other
than those caused by misuse, e.g., IllegalStateException
. CheckedForwardingCall
provides checkedStart()
in which throwing exceptions is allowed.
ForwardingCall.SimpleForwardingCall<ReqT,RespT>
Call.Listener<T>
Modifier | Constructor and Description |
---|---|
protected |
CheckedForwardingCall(Call<ReqT,RespT> delegate) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
checkedStart(Call.Listener<RespT> responseListener,
Metadata.Headers headers)
Subclasses implement the start logic here that would normally belong to
start() . |
protected Call<ReqT,RespT> |
delegate()
Returns the delegated
Call . |
void |
start(Call.Listener<RespT> responseListener,
Metadata.Headers headers)
Start a call, using
responseListener for processing response messages. |
cancel, halfClose, isReady, request, sendPayload
protected abstract void checkedStart(Call.Listener<RespT> responseListener, Metadata.Headers 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 CheckedForwardingCall
and be delivered to responseListener
.
Exceptions must not be thrown after calling this.delegate().start()
, as this
can result in Call.Listener.onClose(io.grpc.Status, io.grpc.Metadata.Trailers)
being called multiple times.
Exception
protected final Call<ReqT,RespT> delegate()
ForwardingCall
Call
.delegate
in class ForwardingCall<ReqT,RespT>
public final void start(Call.Listener<RespT> responseListener, Metadata.Headers headers)
Call
responseListener
for processing response messages.start
in class ForwardingCall<ReqT,RespT>
responseListener
- receives response messagesheaders
- which can contain extra call metadata, e.g. authentication credentials.