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 java.lang.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 boolean
acceptsPoolSize()
Deprecated.FixedTransportChannelProvider doesn't support ChannelPool configurationstatic FixedTransportChannelProvider
create(TransportChannel transportChannel)
Creates a FixedTransportChannelProvider.TransportChannel
getTransportChannel()
Provides a Transport, which could either be a new instance for every call, or the same instance, depending on the implementation.java.lang.String
getTransportName()
The name of the transport.boolean
needsCredentials()
True if credentials are needed before channel creation.boolean
needsEndpoint()
True if the TransportProvider has no endpoint set.boolean
needsExecutor()
True if the TransportProvider needs an executor.boolean
needsHeaders()
True if the TransportProvider has no headers provided.boolean
shouldAutoClose()
Indicates whether the TransportChannel should be closed by the containing client class.TransportChannelProvider
withCredentials(com.google.auth.Credentials credentials)
Sets the credentials that will be applied before channel creation.TransportChannelProvider
withEndpoint(java.lang.String endpoint)
Sets the endpoint to use when constructing a newTransportChannel
.FixedTransportChannelProvider
withExecutor(java.util.concurrent.Executor executor)
Sets the executor to use when constructing a newTransportChannel
.FixedTransportChannelProvider
withExecutor(java.util.concurrent.ScheduledExecutorService executor)
FixedTransportChannelProvider
withHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Sets the headers to use when constructing a newTransportChannel
.TransportChannelProvider
withPoolSize(int size)
Deprecated.FixedTransportChannelProvider doesn't support ChannelPool configuration
-
-
-
Method Detail
-
shouldAutoClose
public boolean shouldAutoClose()
Description copied from interface:TransportChannelProvider
Indicates whether the TransportChannel should be closed by the containing client class.- Specified by:
shouldAutoClose
in interfaceTransportChannelProvider
-
needsExecutor
public boolean needsExecutor()
Description copied from interface:TransportChannelProvider
True if the TransportProvider needs an executor.- Specified by:
needsExecutor
in interfaceTransportChannelProvider
-
withExecutor
public FixedTransportChannelProvider withExecutor(java.util.concurrent.ScheduledExecutorService executor)
- Specified by:
withExecutor
in interfaceTransportChannelProvider
-
withExecutor
public FixedTransportChannelProvider withExecutor(java.util.concurrent.Executor executor)
Description copied from interface:TransportChannelProvider
Sets the executor to use when constructing a newTransportChannel
.- Specified by:
withExecutor
in interfaceTransportChannelProvider
-
needsHeaders
public boolean needsHeaders()
Description copied from interface:TransportChannelProvider
True if the TransportProvider has no headers provided.- Specified by:
needsHeaders
in interfaceTransportChannelProvider
-
withHeaders
public FixedTransportChannelProvider withHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Description copied from interface:TransportChannelProvider
Sets the headers to use when constructing a newTransportChannel
.This method should only be called if
TransportChannelProvider.needsHeaders()
returns true.- Specified by:
withHeaders
in interfaceTransportChannelProvider
-
needsEndpoint
public boolean needsEndpoint()
Description copied from interface:TransportChannelProvider
True if the TransportProvider has no endpoint set.- Specified by:
needsEndpoint
in interfaceTransportChannelProvider
-
withEndpoint
public TransportChannelProvider withEndpoint(java.lang.String endpoint)
Description copied from interface:TransportChannelProvider
Sets the endpoint to use when constructing a newTransportChannel
.This method should only be called if
TransportChannelProvider.needsEndpoint()
returns true.- Specified by:
withEndpoint
in interfaceTransportChannelProvider
-
acceptsPoolSize
@Deprecated public boolean acceptsPoolSize()
Deprecated.FixedTransportChannelProvider doesn't support ChannelPool configurationDescription copied from interface:TransportChannelProvider
Reports whether this provider allows pool size customization.- Specified by:
acceptsPoolSize
in interfaceTransportChannelProvider
-
withPoolSize
@Deprecated public TransportChannelProvider withPoolSize(int size)
Deprecated.FixedTransportChannelProvider doesn't support ChannelPool configurationDescription copied from interface:TransportChannelProvider
Number of underlying transport channels to open. Calls will be load balanced across them.- Specified by:
withPoolSize
in interfaceTransportChannelProvider
-
getTransportChannel
public TransportChannel getTransportChannel() throws java.io.IOException
Description copied from interface:TransportChannelProvider
Provides 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:
getTransportChannel
in interfaceTransportChannelProvider
- Throws:
java.io.IOException
-
getTransportName
public java.lang.String getTransportName()
Description copied from interface:TransportChannelProvider
The name of the transport.This string can be used for identifying transports for switching logic.
- Specified by:
getTransportName
in interfaceTransportChannelProvider
-
needsCredentials
public boolean needsCredentials()
Description copied from interface:TransportChannelProvider
True if credentials are needed before channel creation.- Specified by:
needsCredentials
in interfaceTransportChannelProvider
-
withCredentials
public TransportChannelProvider withCredentials(com.google.auth.Credentials credentials)
Description copied from interface:TransportChannelProvider
Sets the credentials that will be applied before channel creation.- Specified by:
withCredentials
in interfaceTransportChannelProvider
-
create
public static FixedTransportChannelProvider create(TransportChannel transportChannel)
Creates a FixedTransportChannelProvider.
-
-