Package com.google.api.gax.rpc
Class FixedTransportChannelProvider
- java.lang.Object
-
- com.google.api.gax.rpc.FixedTransportChannelProvider
-
- All Implemented Interfaces:
TransportChannelProvider
@InternalExtensionOnly public class FixedTransportChannelProvider extends Object implements TransportChannelProvider
An instance of TransportChannelProvider that always provides the same TransportChannel.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanacceptsPoolSize()Deprecated.FixedTransportChannelProvider doesn't support ChannelPool configurationstatic FixedTransportChannelProvidercreate(TransportChannel transportChannel)Creates a FixedTransportChannelProvider.TransportChannelgetTransportChannel()Provides a Transport, which could either be a new instance for every call, or the same instance, depending on the implementation.StringgetTransportName()The name of the transport.booleanneedsCredentials()True if credentials are needed before channel creation.booleanneedsEndpoint()True if the TransportProvider has no endpoint set.booleanneedsExecutor()True if the TransportProvider needs an executor.booleanneedsHeaders()True if the TransportProvider has no headers provided.booleanshouldAutoClose()Indicates whether the TransportChannel should be closed by the containing client class.TransportChannelProviderwithCredentials(com.google.auth.Credentials credentials)Sets the credentials that will be applied before channel creation.TransportChannelProviderwithEndpoint(String endpoint)Sets the endpoint to use when constructing a newTransportChannel.FixedTransportChannelProviderwithExecutor(Executor executor)Sets the executor to use when constructing a newTransportChannel.FixedTransportChannelProviderwithExecutor(ScheduledExecutorService executor)FixedTransportChannelProviderwithHeaders(Map<String,String> headers)Sets the headers to use when constructing a newTransportChannel.TransportChannelProviderwithPoolSize(int size)Deprecated.FixedTransportChannelProvider doesn't support ChannelPool configuration
-
-
-
Method Detail
-
shouldAutoClose
public boolean shouldAutoClose()
Description copied from interface:TransportChannelProviderIndicates whether the TransportChannel should be closed by the containing client class.- Specified by:
shouldAutoClosein interfaceTransportChannelProvider
-
needsExecutor
public boolean needsExecutor()
Description copied from interface:TransportChannelProviderTrue if the TransportProvider needs an executor.- Specified by:
needsExecutorin interfaceTransportChannelProvider
-
withExecutor
public FixedTransportChannelProvider withExecutor(ScheduledExecutorService executor)
- Specified by:
withExecutorin interfaceTransportChannelProvider
-
withExecutor
public FixedTransportChannelProvider withExecutor(Executor executor)
Description copied from interface:TransportChannelProviderSets the executor to use when constructing a newTransportChannel.- Specified by:
withExecutorin interfaceTransportChannelProvider
-
needsHeaders
public boolean needsHeaders()
Description copied from interface:TransportChannelProviderTrue if the TransportProvider has no headers provided.- Specified by:
needsHeadersin interfaceTransportChannelProvider
-
withHeaders
public FixedTransportChannelProvider withHeaders(Map<String,String> headers)
Description copied from interface:TransportChannelProviderSets the headers to use when constructing a newTransportChannel.This method should only be called if
TransportChannelProvider.needsHeaders()returns true.- Specified by:
withHeadersin interfaceTransportChannelProvider
-
needsEndpoint
public boolean needsEndpoint()
Description copied from interface:TransportChannelProviderTrue if the TransportProvider has no endpoint set.- Specified by:
needsEndpointin interfaceTransportChannelProvider
-
withEndpoint
public TransportChannelProvider withEndpoint(String endpoint)
Description copied from interface:TransportChannelProviderSets the endpoint to use when constructing a newTransportChannel.This method should only be called if
TransportChannelProvider.needsEndpoint()returns true.- Specified by:
withEndpointin interfaceTransportChannelProvider
-
acceptsPoolSize
@Deprecated public boolean acceptsPoolSize()
Deprecated.FixedTransportChannelProvider doesn't support ChannelPool configurationDescription copied from interface:TransportChannelProviderReports whether this provider allows pool size customization.- Specified by:
acceptsPoolSizein interfaceTransportChannelProvider
-
withPoolSize
@Deprecated public TransportChannelProvider withPoolSize(int size)
Deprecated.FixedTransportChannelProvider doesn't support ChannelPool configurationDescription copied from interface:TransportChannelProviderNumber of underlying transport channels to open. Calls will be load balanced across them.- Specified by:
withPoolSizein interfaceTransportChannelProvider
-
getTransportChannel
public TransportChannel getTransportChannel() throws IOException
Description copied from interface:TransportChannelProviderProvides a Transport, which could either be a new instance for every call, or the same instance, depending on the implementation.If
TransportChannelProvider.needsExecutor()is true, thenTransportChannelProvider.withExecutor(Executor)needs to be called first to provide an executor.If
TransportChannelProvider.needsHeaders()is true, thenTransportChannelProvider.withHeaders(Map)needs to be called first to provide headers.if
TransportChannelProvider.needsEndpoint()is true, thenTransportChannelProvider.withEndpoint(String)needs to be called first to provide an endpoint.- Specified by:
getTransportChannelin interfaceTransportChannelProvider- Throws:
IOException
-
getTransportName
public String getTransportName()
Description copied from interface:TransportChannelProviderThe name of the transport.This string can be used for identifying transports for switching logic.
- Specified by:
getTransportNamein interfaceTransportChannelProvider
-
needsCredentials
public boolean needsCredentials()
Description copied from interface:TransportChannelProviderTrue if credentials are needed before channel creation.- Specified by:
needsCredentialsin interfaceTransportChannelProvider
-
withCredentials
public TransportChannelProvider withCredentials(com.google.auth.Credentials credentials)
Description copied from interface:TransportChannelProviderSets the credentials that will be applied before channel creation.- Specified by:
withCredentialsin interfaceTransportChannelProvider
-
create
public static FixedTransportChannelProvider create(TransportChannel transportChannel)
Creates a FixedTransportChannelProvider.
-
-