Class InstantiatingGrpcChannelProvider.Builder (2.8.1)

public static final class InstantiatingGrpcChannelProvider.Builder

Inheritance

java.lang.Object > InstantiatingGrpcChannelProvider.Builder

Methods

build()

public InstantiatingGrpcChannelProvider build()
Returns
TypeDescription
InstantiatingGrpcChannelProvider

getChannelConfigurator()

public ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> getChannelConfigurator()
Returns
TypeDescription
com.google.api.core.ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder>

getEndpoint()

public String getEndpoint()
Returns
TypeDescription
String

getKeepAliveTime()

public Duration getKeepAliveTime()

The time without read activity before sending a keepalive ping.

Returns
TypeDescription
org.threeten.bp.Duration

getKeepAliveTimeout()

public Duration getKeepAliveTimeout()

The time without read activity after sending a keepalive ping.

Returns
TypeDescription
org.threeten.bp.Duration

getKeepAliveWithoutCalls()

public Boolean getKeepAliveWithoutCalls()

Whether keepalive will be performed when there are no outstanding RPCs.

Returns
TypeDescription
Boolean

getMaxInboundMessageSize()

public Integer getMaxInboundMessageSize()

The maximum message size allowed to be received on the channel.

Returns
TypeDescription
Integer

getMaxInboundMetadataSize()

public Integer getMaxInboundMetadataSize()

The maximum metadata size allowed to be received on the channel.

Returns
TypeDescription
Integer

getPoolSize()

public int getPoolSize()

Number of underlying grpc channels to open. Calls will be load balanced round robin across them.

Returns
TypeDescription
int

setAllowNonDefaultServiceAccount(boolean allowNonDefaultServiceAccount)

public InstantiatingGrpcChannelProvider.Builder setAllowNonDefaultServiceAccount(boolean allowNonDefaultServiceAccount)

Whether allow non-default service account for DirectPath.

Parameter
NameDescription
allowNonDefaultServiceAccountboolean
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setAttemptDirectPath(boolean attemptDirectPath)

public InstantiatingGrpcChannelProvider.Builder setAttemptDirectPath(boolean attemptDirectPath)

Whether attempt DirectPath.

Parameter
NameDescription
attemptDirectPathboolean
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setChannelConfigurator(ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> channelConfigurator)

public InstantiatingGrpcChannelProvider.Builder setChannelConfigurator(ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> channelConfigurator)

Add a callback that can intercept channel creation.

This can be used for advanced configuration like setting the netty event loop. The callback will be invoked with a fully configured channel builder, which the callback can augment or replace.

Parameter
NameDescription
channelConfiguratorcom.google.api.core.ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder>
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setChannelPrimer(ChannelPrimer channelPrimer)

public InstantiatingGrpcChannelProvider.Builder setChannelPrimer(ChannelPrimer channelPrimer)

By setting a channelPrimer, the ChannelPool created by the provider will be refreshing ChannelPool. channelPrimer will be invoked periodically when the channels are refreshed

This is public only for technical reasons, for advanced usage.

Parameter
NameDescription
channelPrimerChannelPrimer

invoked when the channels are refreshed

Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

builder for the provider

setChannelsPerCpu(double multiplier)

public InstantiatingGrpcChannelProvider.Builder setChannelsPerCpu(double multiplier)

Sets the number of channels relative to the available CPUs.

Parameter
NameDescription
multiplierdouble
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setChannelsPerCpu(double multiplier, int maxChannels)

public InstantiatingGrpcChannelProvider.Builder setChannelsPerCpu(double multiplier, int maxChannels)
Parameters
NameDescription
multiplierdouble
maxChannelsint
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setCredentials(Credentials credentials)

public InstantiatingGrpcChannelProvider.Builder setCredentials(Credentials credentials)
Parameter
NameDescription
credentialscom.google.auth.Credentials
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setDirectPathServiceConfig(Map<String,?> serviceConfig)

public InstantiatingGrpcChannelProvider.Builder setDirectPathServiceConfig(Map<String,?> serviceConfig)

Sets a service config for direct path. If direct path is not enabled, the provided service config will be ignored.

See the service config proto definition for more details.

Parameter
NameDescription
serviceConfigMap<String,?>
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setEndpoint(String endpoint)

public InstantiatingGrpcChannelProvider.Builder setEndpoint(String endpoint)

Sets the endpoint used to reach the service, eg "localhost:8080".

Parameter
NameDescription
endpointString
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setExecutor(Executor executor)

public InstantiatingGrpcChannelProvider.Builder setExecutor(Executor executor)

Sets the Executor for this TransportChannelProvider.

This is optional; if it is not provided, needsExecutor() will return true, meaning that an Executor must be provided when getChannel is called on the constructed TransportChannelProvider instance. Note: GrpcTransportProvider will automatically provide its own Executor in this circumstance when it calls getChannel.

Parameter
NameDescription
executorExecutor
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setExecutorProvider(ExecutorProvider executorProvider) (deprecated)

public InstantiatingGrpcChannelProvider.Builder setExecutorProvider(ExecutorProvider executorProvider)

(deprecated) Please use #setExecutor(Executor).

Parameter
NameDescription
executorProviderExecutorProvider
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setHeaderProvider(HeaderProvider headerProvider)

public InstantiatingGrpcChannelProvider.Builder setHeaderProvider(HeaderProvider headerProvider)

Sets the HeaderProvider for this TransportChannelProvider.

This is optional; if it is not provided, needsHeaders() will return true, meaning that headers must be provided when getChannel is called on the constructed TransportChannelProvider instance.

Parameter
NameDescription
headerProviderHeaderProvider
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setInterceptorProvider(GrpcInterceptorProvider interceptorProvider)

public InstantiatingGrpcChannelProvider.Builder setInterceptorProvider(GrpcInterceptorProvider interceptorProvider)

Sets the GrpcInterceptorProvider for this TransportChannelProvider.

The provider will be called once for each underlying gRPC ManagedChannel that is created. It is recommended to return a new list of new interceptors on each call so that interceptors are not shared among channels, but this is not required.

Parameter
NameDescription
interceptorProviderGrpcInterceptorProvider
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setKeepAliveTime(Duration duration)

public InstantiatingGrpcChannelProvider.Builder setKeepAliveTime(Duration duration)

The time without read activity before sending a keepalive ping.

Parameter
NameDescription
durationorg.threeten.bp.Duration
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setKeepAliveTimeout(Duration duration)

public InstantiatingGrpcChannelProvider.Builder setKeepAliveTimeout(Duration duration)

The time without read activity after sending a keepalive ping.

Parameter
NameDescription
durationorg.threeten.bp.Duration
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setKeepAliveWithoutCalls(Boolean keepalive)

public InstantiatingGrpcChannelProvider.Builder setKeepAliveWithoutCalls(Boolean keepalive)

Whether keepalive will be performed when there are no outstanding RPCs.

Parameter
NameDescription
keepaliveBoolean
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setMaxInboundMessageSize(Integer max)

public InstantiatingGrpcChannelProvider.Builder setMaxInboundMessageSize(Integer max)

The maximum message size allowed to be received on the channel.

Parameter
NameDescription
maxInteger
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setMaxInboundMetadataSize(Integer max)

public InstantiatingGrpcChannelProvider.Builder setMaxInboundMetadataSize(Integer max)

The maximum metadata size allowed to be received on the channel.

Parameter
NameDescription
maxInteger
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder

setPoolSize(int poolSize)

public InstantiatingGrpcChannelProvider.Builder setPoolSize(int poolSize)

Number of underlying grpc channels to open. Calls will be load balanced round robin across them

Parameter
NameDescription
poolSizeint
Returns
TypeDescription
InstantiatingGrpcChannelProvider.Builder