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>
A 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.

  • Field Details

  • Constructor Details

    • CheckedForwardingClientCall

      protected CheckedForwardingClientCall(ClientCall<ReqT,RespT> delegate)
  • 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 to 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(Status, Metadata) being called multiple times.

      Throws:
      Exception
    • delegate

      protected final ClientCall<ReqT,RespT> delegate()
      Description copied from class: ForwardingClientCall
      Returns the delegated ClientCall.
      Specified by:
      delegate in class ForwardingClientCall<ReqT,RespT>
    • start

      public final void start(ClientCall.Listener<RespT> responseListener, Metadata headers)
      Description copied from class: ClientCall
      Start a call, using responseListener for 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 Metadata is not thread-safe, the caller must not access (read or write) headers after this point.

      Overrides:
      start in class ForwardingClientCall<ReqT,RespT>
      Parameters:
      responseListener - receives response messages
      headers - which can contain extra call metadata, e.g. authentication credentials.