- 2.57.0 (latest)
- 2.55.0
- 2.54.1
- 2.53.0
- 2.52.0
- 2.51.0
- 2.50.0
- 2.49.0
- 2.48.1
- 2.47.0
- 2.46.1
- 2.45.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.39.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.1
- 2.33.0
- 2.32.1
- 2.31.1
- 2.30.1
- 2.24.0
- 2.23.3
- 2.22.0
- 2.21.0
- 2.20.1
- 2.19.6
- 2.18.7
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.2
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.1
- 2.7.1
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();
Methods
acceptsPoolSize()
public abstract boolean acceptsPoolSize()
Reports whether this provider allows pool size customization.
Type | Description |
boolean |
getTransportChannel()
public abstract 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 abstract String getTransportName()
The name of the transport.
This string can be used for identifying transports for switching logic.
Type | Description |
String |
needsCredentials()
public abstract boolean needsCredentials()
True if credentials are needed before channel creation.
Type | Description |
boolean |
needsEndpoint()
public abstract boolean needsEndpoint()
True if the TransportProvider has no endpoint set.
Type | Description |
boolean |
needsExecutor() (deprecated)
public abstract boolean needsExecutor()
(deprecated) Channel providers will have default executors if they need one.
True if the TransportProvider needs an executor.Type | Description |
boolean |
needsHeaders()
public abstract boolean needsHeaders()
True if the TransportProvider has no headers provided.
Type | Description |
boolean |
shouldAutoClose()
public abstract boolean shouldAutoClose()
Indicates whether the TransportChannel should be closed by the containing client class.
Type | Description |
boolean |
withCredentials(Credentials credentials)
public abstract 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 abstract 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 abstract TransportChannelProvider withExecutor(Executor executor)
Sets the executor to use when constructing a new TransportChannel.
Name | Description |
executor | Executor |
Type | Description |
TransportChannelProvider |
withExecutor(ScheduledExecutorService executor) (deprecated)
public abstract TransportChannelProvider withExecutor(ScheduledExecutorService executor)
(deprecated) Please use #withExecutor(Executor).
Name | Description |
executor | ScheduledExecutorService |
Type | Description |
TransportChannelProvider |
withHeaders(Map<String,String> headers)
public abstract TransportChannelProvider 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 |
TransportChannelProvider |
withPoolSize(int size)
public abstract 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 |