Class InstantiatingGrpcChannelProvider.Builder
- java.lang.Object
-
- com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.Builder
-
- Enclosing class:
- InstantiatingGrpcChannelProvider
public static final class InstantiatingGrpcChannelProvider.Builder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description InstantiatingGrpcChannelProviderbuild()ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder>getChannelConfigurator()StringgetEndpoint()org.threeten.bp.DurationgetKeepAliveTime()The time without read activity before sending a keepalive ping.org.threeten.bp.DurationgetKeepAliveTimeout()The time without read activity after sending a keepalive ping.BooleangetKeepAliveWithoutCalls()Whether keepalive will be performed when there are no outstanding RPCs.IntegergetMaxInboundMessageSize()The maximum message size allowed to be received on the channel.IntegergetMaxInboundMetadataSize()The maximum metadata size allowed to be received on the channel.intgetPoolSize()Deprecated.Please usesetChannelPoolSettings(ChannelPoolSettings)InstantiatingGrpcChannelProvider.BuildersetAllowNonDefaultServiceAccount(boolean allowNonDefaultServiceAccount)Whether allow non-default service account for DirectPath.InstantiatingGrpcChannelProvider.BuildersetAttemptDirectPath(boolean attemptDirectPath)Whether attempt DirectPath.InstantiatingGrpcChannelProvider.BuildersetChannelConfigurator(ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder> channelConfigurator)Add a callback that can intercept channel creation.InstantiatingGrpcChannelProvider.BuildersetChannelPoolSettings(ChannelPoolSettings settings)InstantiatingGrpcChannelProvider.BuildersetChannelPrimer(ChannelPrimer channelPrimer)By setting a channelPrimer, the ChannelPool created by the provider will be refreshing ChannelPool.InstantiatingGrpcChannelProvider.BuildersetChannelsPerCpu(double multiplier)Deprecated.Please usesetChannelPoolSettings(ChannelPoolSettings)InstantiatingGrpcChannelProvider.BuildersetChannelsPerCpu(double multiplier, int maxChannels)Deprecated.Please usesetChannelPoolSettings(ChannelPoolSettings)InstantiatingGrpcChannelProvider.BuildersetCredentials(com.google.auth.Credentials credentials)InstantiatingGrpcChannelProvider.BuildersetDirectPathServiceConfig(Map<String,?> serviceConfig)Sets a service config for direct path.InstantiatingGrpcChannelProvider.BuildersetEndpoint(String endpoint)Sets the endpoint used to reach the service, eg "localhost:8080".InstantiatingGrpcChannelProvider.BuildersetExecutor(Executor executor)Sets the Executor for this TransportChannelProvider.InstantiatingGrpcChannelProvider.BuildersetExecutorProvider(ExecutorProvider executorProvider)Deprecated.Please usesetExecutor(Executor).InstantiatingGrpcChannelProvider.BuildersetHeaderProvider(HeaderProvider headerProvider)Sets the HeaderProvider for this TransportChannelProvider.InstantiatingGrpcChannelProvider.BuildersetInterceptorProvider(GrpcInterceptorProvider interceptorProvider)Sets the GrpcInterceptorProvider for this TransportChannelProvider.InstantiatingGrpcChannelProvider.BuildersetKeepAliveTime(org.threeten.bp.Duration duration)The time without read activity before sending a keepalive ping.InstantiatingGrpcChannelProvider.BuildersetKeepAliveTimeout(org.threeten.bp.Duration duration)The time without read activity after sending a keepalive ping.InstantiatingGrpcChannelProvider.BuildersetKeepAliveWithoutCalls(Boolean keepalive)Whether keepalive will be performed when there are no outstanding RPCs.InstantiatingGrpcChannelProvider.BuildersetMaxInboundMessageSize(Integer max)The maximum message size allowed to be received on the channel.InstantiatingGrpcChannelProvider.BuildersetMaxInboundMetadataSize(Integer max)The maximum metadata size allowed to be received on the channel.InstantiatingGrpcChannelProvider.BuildersetPoolSize(int poolSize)Deprecated.Please usesetChannelPoolSettings(ChannelPoolSettings)
-
-
-
Method Detail
-
setExecutor
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.
-
setExecutorProvider
@Deprecated public InstantiatingGrpcChannelProvider.Builder setExecutorProvider(ExecutorProvider executorProvider)
Deprecated.Please usesetExecutor(Executor).
-
setHeaderProvider
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.
-
setEndpoint
public InstantiatingGrpcChannelProvider.Builder setEndpoint(String endpoint)
Sets the endpoint used to reach the service, eg "localhost:8080".
-
setInterceptorProvider
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.
-
getEndpoint
public String getEndpoint()
-
setMaxInboundMessageSize
public InstantiatingGrpcChannelProvider.Builder setMaxInboundMessageSize(Integer max)
The maximum message size allowed to be received on the channel.
-
getMaxInboundMessageSize
public Integer getMaxInboundMessageSize()
The maximum message size allowed to be received on the channel.
-
setMaxInboundMetadataSize
@BetaApi("The surface for maximum metadata size is not stable yet and may change in the future.") public InstantiatingGrpcChannelProvider.Builder setMaxInboundMetadataSize(Integer max)
The maximum metadata size allowed to be received on the channel.
-
getMaxInboundMetadataSize
@BetaApi("The surface for maximum metadata size is not stable yet and may change in the future.") public Integer getMaxInboundMetadataSize()
The maximum metadata size allowed to be received on the channel.
-
setKeepAliveTime
public InstantiatingGrpcChannelProvider.Builder setKeepAliveTime(org.threeten.bp.Duration duration)
The time without read activity before sending a keepalive ping.
-
getKeepAliveTime
public org.threeten.bp.Duration getKeepAliveTime()
The time without read activity before sending a keepalive ping.
-
setKeepAliveTimeout
public InstantiatingGrpcChannelProvider.Builder setKeepAliveTimeout(org.threeten.bp.Duration duration)
The time without read activity after sending a keepalive ping.
-
getKeepAliveTimeout
public org.threeten.bp.Duration getKeepAliveTimeout()
The time without read activity after sending a keepalive ping.
-
setKeepAliveWithoutCalls
public InstantiatingGrpcChannelProvider.Builder setKeepAliveWithoutCalls(Boolean keepalive)
Whether keepalive will be performed when there are no outstanding RPCs.
-
getKeepAliveWithoutCalls
public Boolean getKeepAliveWithoutCalls()
Whether keepalive will be performed when there are no outstanding RPCs.
-
getPoolSize
@Deprecated public int getPoolSize()
Deprecated.Please usesetChannelPoolSettings(ChannelPoolSettings)
-
setPoolSize
@Deprecated public InstantiatingGrpcChannelProvider.Builder setPoolSize(int poolSize)
Deprecated.Please usesetChannelPoolSettings(ChannelPoolSettings)
-
setChannelsPerCpu
@Deprecated public InstantiatingGrpcChannelProvider.Builder setChannelsPerCpu(double multiplier)
Deprecated.Please usesetChannelPoolSettings(ChannelPoolSettings)
-
setChannelsPerCpu
@Deprecated public InstantiatingGrpcChannelProvider.Builder setChannelsPerCpu(double multiplier, int maxChannels)
Deprecated.Please usesetChannelPoolSettings(ChannelPoolSettings)
-
setChannelPoolSettings
@BetaApi("Channel pool sizing api is not yet stable") public InstantiatingGrpcChannelProvider.Builder setChannelPoolSettings(ChannelPoolSettings settings)
-
setCredentials
public InstantiatingGrpcChannelProvider.Builder setCredentials(com.google.auth.Credentials credentials)
-
setChannelPrimer
@InternalApi("For internal use by google-cloud-java clients only") 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 refreshedThis is public only for technical reasons, for advanced usage.
- Parameters:
channelPrimer- invoked when the channels are refreshed- Returns:
- builder for the provider
-
setAttemptDirectPath
@InternalApi("For internal use by google-cloud-java clients only") public InstantiatingGrpcChannelProvider.Builder setAttemptDirectPath(boolean attemptDirectPath)
Whether attempt DirectPath.
-
setAllowNonDefaultServiceAccount
@InternalApi("For internal use by google-cloud-java clients only") public InstantiatingGrpcChannelProvider.Builder setAllowNonDefaultServiceAccount(boolean allowNonDefaultServiceAccount)
Whether allow non-default service account for DirectPath.
-
setDirectPathServiceConfig
@InternalApi("For internal use by google-cloud-java clients only") 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.
-
build
public InstantiatingGrpcChannelProvider build()
-
setChannelConfigurator
@BetaApi("Surface for advanced channel configuration is not yet stable") public InstantiatingGrpcChannelProvider.Builder setChannelConfigurator(@Nullable ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.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.
-
getChannelConfigurator
@Nullable public ApiFunction<io.grpc.ManagedChannelBuilder,io.grpc.ManagedChannelBuilder> getChannelConfigurator()
-
-