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 ForwardingClientCall
ForwardingClientCall.SimpleForwardingClientCall<ReqT,RespT> Nested classes/interfaces inherited from class ClientCall
ClientCall.Listener<T> -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCheckedForwardingClientCall(ClientCall<ReqT, RespT> delegate) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidcheckedStart(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 voidstart(ClientCall.Listener<RespT> responseListener, Metadata headers) Start a call, usingresponseListenerfor processing response messages.Methods inherited from class ForwardingClientCall
sendMessageMethods inherited from class 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 byCheckedForwardingClientCalland be delivered toresponseListener. Exceptions must not be thrown after callingthis.delegate().start(), as this can result inClientCall.Listener.onClose(Status, Metadata)being called multiple times.- Throws:
Exception
-
delegate
Description copied from class:ForwardingClientCallReturns the delegatedClientCall.- Specified by:
delegatein classForwardingClientCall<ReqT,RespT>
-
start
Description copied from class:ClientCallStart a call, usingresponseListenerfor processing response messages.It must be called prior to any other method on this class, except for
ClientCall.cancel(String, Throwable)which may be called at any time.Since
Metadatais not thread-safe, the caller must not access (read or write)headersafter this point.- Overrides:
startin classForwardingClientCall<ReqT,RespT> - Parameters:
responseListener- receives response messagesheaders- which can contain extra call metadata, e.g. authentication credentials.
-