Class ClientInterceptors.CheckedForwardingClientCall<ReqT,RespT>
- Enclosing class:
ClientInterceptors
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.grpc.ForwardingClientCall
ForwardingClientCall.SimpleForwardingClientCall<ReqT,
RespT> Nested classes/interfaces inherited from class io.grpc.ClientCall
ClientCall.Listener<T>
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CheckedForwardingClientCall
(ClientCall<ReqT, RespT> delegate) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
checkedStart
(ClientCall.Listener<RespT> responseListener, Metadata headers) Subclasses implement the start logic here that would normally belong tostart()
.protected final ClientCall
<ReqT, RespT> delegate()
Returns the delegatedClientCall
.final void
start
(ClientCall.Listener<RespT> responseListener, Metadata headers) Start a call, usingresponseListener
for processing response messages.Methods inherited from class io.grpc.ForwardingClientCall
sendMessage
Methods inherited from class io.grpc.PartialForwardingClientCall
cancel, getAttributes, halfClose, isReady, request, setMessageCompression, toString
-
Field Details
-
delegate
-
-
Constructor Details
-
CheckedForwardingClientCall
-
-
Method Details
-
checkedStart
protected abstract void checkedStart(ClientCall.Listener<RespT> responseListener, Metadata headers) throws Exception Subclasses implement the start logic here that would normally belong tostart()
.Implementation should call
this.delegate().start()
in the normal path. Exceptions may safely be thrown prior to callingthis.delegate().start()
. Such exceptions will be handled byCheckedForwardingClientCall
and be delivered toresponseListener
. Exceptions must not be thrown after callingthis.delegate().start()
, as this can result inClientCall.Listener.onClose(io.grpc.Status, io.grpc.Metadata)
being called multiple times.- Throws:
Exception
-
delegate
Description copied from class:ForwardingClientCall
Returns the delegatedClientCall
.- Specified by:
delegate
in classForwardingClientCall<ReqT,
RespT>
-
start
Description copied from class:ClientCall
Start a call, usingresponseListener
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 (read or write)headers
after this point.- Overrides:
start
in classForwardingClientCall<ReqT,
RespT> - Parameters:
responseListener
- receives response messagesheaders
- which can contain extra call metadata, e.g. authentication credentials.
-