Interface TransportChannelProvider

  • All Known Implementing Classes:
    FixedTransportChannelProvider

    @InternalExtensionOnly
    public interface TransportChannelProvider
    Provides an interface to either build a TransportChannel or provide a fixed TransportChannel that will be used to make calls to a service.

    Implementations of TransportChannelProvider may choose to create a new TransportChannel for each call to getTransportChannel(), or may return a fixed TransportChannel instance.

    Callers should use the following pattern to get a channel:

    
     TransportChannelProvider transportChannelProvider = ...;
     if (transportChannelProvider.needsHeaders()) {
       transportChannelProvider = transportChannelProvider.withHeaders(headers);
     }
     // optional: set executor for TransportChannel
     transportChannelProvider.withExecutor(executor);
     TransportChannel transportChannel = transportChannelProvider.getTransportChannel();
     
    • Method Detail

      • shouldAutoClose

        boolean shouldAutoClose()
        Indicates whether the TransportChannel should be closed by the containing client class.
      • needsExecutor

        @Deprecated
        boolean needsExecutor()
        Deprecated.
        Channel providers will have default executors if they need one.
        True if the TransportProvider needs an executor.
      • needsHeaders

        boolean needsHeaders()
        True if the TransportProvider has no headers provided.
      • needsEndpoint

        boolean needsEndpoint()
        True if the TransportProvider has no endpoint set.
      • acceptsPoolSize

        @Deprecated
        boolean acceptsPoolSize()
        Deprecated.
        Pool settings should be configured on the builder of the specific implementation.
        Reports whether this provider allows pool size customization.
      • withPoolSize

        @Deprecated
        TransportChannelProvider withPoolSize​(int size)
        Deprecated.
        Pool settings should be configured on the builder of the specific implementation.
        Number of underlying transport channels to open. Calls will be load balanced across them.
      • needsCredentials

        @BetaApi("The surface to customize credentials is not stable yet and may change in the future.")
        boolean needsCredentials()
        True if credentials are needed before channel creation.
      • withCredentials

        @BetaApi("The surface to customize credentials is not stable yet and may change in the future.")
        TransportChannelProvider withCredentials​(com.google.auth.Credentials credentials)
        Sets the credentials that will be applied before channel creation.
      • getTransportName

        String getTransportName()
        The name of the transport.

        This string can be used for identifying transports for switching logic.