Class FixedTransportChannelProvider (2.19.5)

Stay organized with collections Save and categorize content based on your preferences.
public class FixedTransportChannelProvider implements TransportChannelProvider

An instance of TransportChannelProvider that always provides the same TransportChannel.

Inheritance

java.lang.Object > FixedTransportChannelProvider

Static Methods

create(TransportChannel transportChannel)

public static FixedTransportChannelProvider create(TransportChannel transportChannel)

Creates a FixedTransportChannelProvider.

Parameter
NameDescription
transportChannelTransportChannel
Returns
TypeDescription
FixedTransportChannelProvider

Methods

acceptsPoolSize() (deprecated)

public boolean acceptsPoolSize()

Deprecated. FixedTransportChannelProvider doesn't support ChannelPool configuration

Reports whether this provider allows pool size customization.

Returns
TypeDescription
boolean

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.

Returns
TypeDescription
TransportChannel
Exceptions
TypeDescription
IOException

getTransportName()

public String getTransportName()

The name of the transport.

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

Returns
TypeDescription
String

needsCredentials()

public boolean needsCredentials()

True if credentials are needed before channel creation.

Returns
TypeDescription
boolean

needsEndpoint()

public boolean needsEndpoint()

True if the TransportProvider has no endpoint set.

Returns
TypeDescription
boolean

needsExecutor()

public boolean needsExecutor()

True if the TransportProvider needs an executor.

Returns
TypeDescription
boolean

needsHeaders()

public boolean needsHeaders()

True if the TransportProvider has no headers provided.

Returns
TypeDescription
boolean

shouldAutoClose()

public boolean shouldAutoClose()

Indicates whether the TransportChannel should be closed by the containing client class.

Returns
TypeDescription
boolean

withCredentials(Credentials credentials)

public TransportChannelProvider withCredentials(Credentials credentials)

Sets the credentials that will be applied before channel creation.

Parameter
NameDescription
credentialscom.google.auth.Credentials
Returns
TypeDescription
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.

Parameter
NameDescription
endpointString
Returns
TypeDescription
TransportChannelProvider

withExecutor(Executor executor)

public FixedTransportChannelProvider withExecutor(Executor executor)

Sets the executor to use when constructing a new TransportChannel.

Parameter
NameDescription
executorExecutor
Returns
TypeDescription
FixedTransportChannelProvider

withExecutor(ScheduledExecutorService executor)

public FixedTransportChannelProvider withExecutor(ScheduledExecutorService executor)
Parameter
NameDescription
executorScheduledExecutorService
Returns
TypeDescription
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.

Parameter
NameDescription
headersMap<String,String>
Returns
TypeDescription
FixedTransportChannelProvider

withPoolSize(int size) (deprecated)

public TransportChannelProvider withPoolSize(int size)

Deprecated. FixedTransportChannelProvider doesn't support ChannelPool configuration

Number of underlying transport channels to open. Calls will be load balanced across them.

Parameter
NameDescription
sizeint
Returns
TypeDescription
TransportChannelProvider