public class FixedTransportChannelProvider implements TransportChannelProvider
An instance of TransportChannelProvider that always provides the same TransportChannel.
Implements
TransportChannelProviderMethods
acceptsPoolSize()
public boolean acceptsPoolSize()
Reports whether this provider allows pool size customization.
Type | Description |
boolean |
create(TransportChannel transportChannel)
public static FixedTransportChannelProvider create(TransportChannel transportChannel)
Creates a FixedTransportChannelProvider.
Name | Description |
transportChannel | TransportChannel |
Type | Description |
FixedTransportChannelProvider |
getTransportChannel()
public TransportChannel getTransportChannel()
Provides a Transport, which could either be a new instance for every call, or the same instance, depending on the implementation.
If #needsExecutor() is true, then #withExecutor(Executor) needs to be called first to provide an executor.
If #needsHeaders() is true, then #withHeaders(Map) needs to be called first to provide headers.
if #needsEndpoint() is true, then #withEndpoint(String) needs to be called first to provide an endpoint.
Type | Description |
TransportChannel |
Type | Description |
IOException |
getTransportName()
public String getTransportName()
The name of the transport.
This string can be used for identifying transports for switching logic.
Type | Description |
String |
needsCredentials()
public boolean needsCredentials()
True if credentials are needed before channel creation.
Type | Description |
boolean |
needsEndpoint()
public boolean needsEndpoint()
True if the TransportProvider has no endpoint set.
Type | Description |
boolean |
needsExecutor()
public boolean needsExecutor()
True if the TransportProvider needs an executor.
Type | Description |
boolean |
needsHeaders()
public boolean needsHeaders()
True if the TransportProvider has no headers provided.
Type | Description |
boolean |
shouldAutoClose()
public boolean shouldAutoClose()
Indicates whether the TransportChannel should be closed by the containing client class.
Type | Description |
boolean |
withCredentials(Credentials credentials)
public TransportChannelProvider withCredentials(Credentials credentials)
Sets the credentials that will be applied before channel creation.
Name | Description |
credentials | com.google.auth.Credentials |
Type | Description |
TransportChannelProvider |
withEndpoint(String endpoint)
public TransportChannelProvider withEndpoint(String endpoint)
Sets the endpoint to use when constructing a new TransportChannel.
This method should only be called if #needsEndpoint() returns true.
Name | Description |
endpoint | String |
Type | Description |
TransportChannelProvider |
withExecutor(Executor executor)
public FixedTransportChannelProvider withExecutor(Executor executor)
Sets the executor to use when constructing a new TransportChannel.
Name | Description |
executor | Executor |
Type | Description |
FixedTransportChannelProvider |
withExecutor(ScheduledExecutorService executor)
public FixedTransportChannelProvider withExecutor(ScheduledExecutorService executor)
Name | Description |
executor | ScheduledExecutorService |
Type | Description |
FixedTransportChannelProvider |
withHeaders(Map<String,String> headers)
public FixedTransportChannelProvider withHeaders(Map<String,String> headers)
Sets the headers to use when constructing a new TransportChannel.
This method should only be called if #needsHeaders() returns true.
Name | Description |
headers | Map<String,String> |
Type | Description |
FixedTransportChannelProvider |
withPoolSize(int size)
public TransportChannelProvider withPoolSize(int size)
Number of underlying transport channels to open. Calls will be load balanced across them.
Name | Description |
size | int |
Type | Description |
TransportChannelProvider |