Class ClientInterceptors.CheckedForwardingClientCall<ReqT,RespT>
- java.lang.Object
-
- io.grpc.ClientCall<ReqT,RespT>
-
- io.grpc.PartialForwardingClientCall<ReqT,RespT>
-
- io.grpc.ForwardingClientCall<ReqT,RespT>
-
- io.grpc.ClientInterceptors.CheckedForwardingClientCall<ReqT,RespT>
-
- Enclosing class:
- ClientInterceptors
public abstract static class ClientInterceptors.CheckedForwardingClientCall<ReqT,RespT> extends ForwardingClientCall<ReqT,RespT>
AForwardingClientCall
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
providescheckedStart()
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 Modifier and Type Field Description private ClientCall<ReqT,RespT>
delegate
-
Constructor Summary
Constructors Modifier Constructor Description protected
CheckedForwardingClientCall(ClientCall<ReqT,RespT> delegate)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
checkedStart(ClientCall.Listener<RespT> responseListener, Metadata headers)
Subclasses implement the start logic here that would normally belong tostart()
.protected ClientCall<ReqT,RespT>
delegate()
Returns the delegatedClientCall
.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 Detail
-
delegate
private ClientCall<ReqT,RespT> delegate
-
-
Constructor Detail
-
CheckedForwardingClientCall
protected CheckedForwardingClientCall(ClientCall<ReqT,RespT> delegate)
-
-
Method Detail
-
checkedStart
protected abstract void checkedStart(ClientCall.Listener<RespT> responseListener, Metadata headers) throws java.lang.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:
java.lang.Exception
-
delegate
protected final ClientCall<ReqT,RespT> delegate()
Description copied from class:ForwardingClientCall
Returns the delegatedClientCall
.- Specified by:
delegate
in classForwardingClientCall<ReqT,RespT>
-
start
public final void start(ClientCall.Listener<RespT> responseListener, Metadata headers)
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.
-
-