Package com.google.api.gax.rpc
Class StubSettings.Builder<SettingsT extends StubSettings<SettingsT>,B extends StubSettings.Builder<SettingsT,B>>
- java.lang.Object
-
- com.google.api.gax.rpc.StubSettings.Builder<SettingsT,B>
-
- Enclosing class:
- StubSettings<SettingsT extends StubSettings<SettingsT>>
public abstract static class StubSettings.Builder<SettingsT extends StubSettings<SettingsT>,B extends StubSettings.Builder<SettingsT,B>> extends Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Builder()
protected
Builder(ClientContext clientContext)
protected
Builder(StubSettings settings)
Create a builder from a StubSettings object.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static void
applyToAllUnaryMethods(Iterable<UnaryCallSettings.Builder<?,?>> methodSettingsBuilders, com.google.api.core.ApiFunction<UnaryCallSettings.Builder<?,?>,Void> settingsUpdater)
Applies the given settings updater function to the given method settings builders.abstract <B extends StubSettings<B>>
StubSettings<B>build()
ExecutorProvider
getBackgroundExecutorProvider()
Gets the ExecutorProvider that was previously set on this Builder.com.google.api.core.ApiClock
getClock()
Gets the ApiClock that was previously set on this Builder.CredentialsProvider
getCredentialsProvider()
Gets the CredentialsProvider that was previously set on this Builder.String
getEndpoint()
ExecutorProvider
getExecutorProvider()
Deprecated.Please usegetBackgroundExecutorProvider()
.HeaderProvider
getHeaderProvider()
Gets the custom HeaderProvider that was previously set on this Builder.protected HeaderProvider
getInternalHeaderProvider()
Gets the internal HeaderProvider that was previously set on this Builder.String
getMtlsEndpoint()
String
getQuotaProjectId()
Gets the QuotaProjectId that was previously set on this Builder.org.threeten.bp.Duration
getStreamWatchdogCheckInterval()
WatchdogProvider
getStreamWatchdogProvider()
Gets theWatchdogProvider
that was previously set on this Builder.ApiTracerFactory
getTracerFactory()
TransportChannelProvider
getTransportChannelProvider()
Gets the TransportProvider that was previously set on this Builder.protected B
self()
B
setBackgroundExecutorProvider(ExecutorProvider backgroundExecutorProvider)
Sets the executor to use for running scheduled API call logic (such as retries and long-running operations).B
setClock(com.google.api.core.ApiClock clock)
Sets the clock to use for retry logic.B
setCredentialsProvider(CredentialsProvider credentialsProvider)
Sets the CredentialsProvider to use for getting the credentials to make calls with.B
setEndpoint(String endpoint)
B
setExecutorProvider(ExecutorProvider executorProvider)
Deprecated.Please usesetBackgroundExecutorProvider(ExecutorProvider)
for setting executor to use for running scheduled API call logic.B
setHeaderProvider(HeaderProvider headerProvider)
Sets the HeaderProvider for getting custom static headers for http requests.protected B
setInternalHeaderProvider(HeaderProvider internalHeaderProvider)
Sets the HeaderProvider for getting internal (library-defined) static headers for http requests.B
setMtlsEndpoint(String mtlsEndpoint)
B
setQuotaProjectId(String quotaProjectId)
B
setStreamWatchdogCheckInterval(org.threeten.bp.Duration checkInterval)
Sets how often theWatchdog
will check ongoing streaming RPCs.B
setStreamWatchdogProvider(WatchdogProvider streamWatchdogProvider)
Sets theWatchdogProvider
to use for streaming RPC.protected B
setSwitchToMtlsEndpointAllowed(boolean switchToMtlsEndpointAllowed)
B
setTracerFactory(ApiTracerFactory tracerFactory)
Configures theApiTracerFactory
that will be used to generate traces.B
setTransportChannelProvider(TransportChannelProvider transportChannelProvider)
Sets the TransportProvider to use for getting the transport-specific context to make calls with.String
toString()
-
-
-
Constructor Detail
-
Builder
protected Builder(StubSettings settings)
Create a builder from a StubSettings object.
-
Builder
protected Builder(ClientContext clientContext)
-
Builder
protected Builder()
-
-
Method Detail
-
self
protected B self()
-
setExecutorProvider
@Deprecated public B setExecutorProvider(ExecutorProvider executorProvider)
Deprecated.Please usesetBackgroundExecutorProvider(ExecutorProvider)
for setting executor to use for running scheduled API call logic. To set executor forTransportChannelProvider
, please useTransportChannelProvider.withExecutor(Executor)
instead.Sets the ExecutorProvider to use for getting the executor to use for running asynchronous API call logic (such as retries and long-running operations), and also to pass to the transport settings if an executor is needed for the transport and it doesn't have its own executor provider.
-
setBackgroundExecutorProvider
public B setBackgroundExecutorProvider(ExecutorProvider backgroundExecutorProvider)
Sets the executor to use for running scheduled API call logic (such as retries and long-running operations).
-
setCredentialsProvider
public B setCredentialsProvider(CredentialsProvider credentialsProvider)
Sets the CredentialsProvider to use for getting the credentials to make calls with.
-
setHeaderProvider
public B setHeaderProvider(HeaderProvider headerProvider)
Sets the HeaderProvider for getting custom static headers for http requests. The header provider will be called during client construction only once. The headers returned by the provider will be cached and supplied as is for each request issued by the constructed client. Some reserved headers can be overridden (e.g. Content-Type) or merged with the default value (e.g. User-Agent) by the underlying transport layer.
-
setInternalHeaderProvider
protected B setInternalHeaderProvider(HeaderProvider internalHeaderProvider)
Sets the HeaderProvider for getting internal (library-defined) static headers for http requests. The header provider will be called during client construction only once. The headers returned by the provider will be cached and supplied as is for each request issued by the constructed client. Some reserved headers can be overridden (e.g. Content-Type) or merged with the default value (e.g. User-Agent) by the underlying transport layer.
-
setTransportChannelProvider
public B setTransportChannelProvider(TransportChannelProvider transportChannelProvider)
Sets the TransportProvider to use for getting the transport-specific context to make calls with.
-
setStreamWatchdogProvider
public B setStreamWatchdogProvider(@Nullable WatchdogProvider streamWatchdogProvider)
Sets theWatchdogProvider
to use for streaming RPC.This will default to a
InstantiatingWatchdogProvider
if it is not set.
-
setClock
public B setClock(com.google.api.core.ApiClock clock)
Sets the clock to use for retry logic.This will default to a system clock if it is not set.
-
setSwitchToMtlsEndpointAllowed
protected B setSwitchToMtlsEndpointAllowed(boolean switchToMtlsEndpointAllowed)
-
setStreamWatchdogCheckInterval
public B setStreamWatchdogCheckInterval(@Nonnull org.threeten.bp.Duration checkInterval)
Sets how often theWatchdog
will check ongoing streaming RPCs. Defaults to 10 secs. UseDuration.ZERO
to disable.
-
setTracerFactory
@BetaApi("The surface for tracing is not stable yet and may change in the future.") public B setTracerFactory(@Nonnull ApiTracerFactory tracerFactory)
Configures theApiTracerFactory
that will be used to generate traces.- Parameters:
tracerFactory
- an instance ofApiTracerFactory
to set.
-
getExecutorProvider
@Deprecated public ExecutorProvider getExecutorProvider()
Deprecated.Please usegetBackgroundExecutorProvider()
.
-
getBackgroundExecutorProvider
public ExecutorProvider getBackgroundExecutorProvider()
Gets the ExecutorProvider that was previously set on this Builder.
-
getTransportChannelProvider
public TransportChannelProvider getTransportChannelProvider()
Gets the TransportProvider that was previously set on this Builder.
-
getCredentialsProvider
public CredentialsProvider getCredentialsProvider()
Gets the CredentialsProvider that was previously set on this Builder.
-
getHeaderProvider
public HeaderProvider getHeaderProvider()
Gets the custom HeaderProvider that was previously set on this Builder.
-
getInternalHeaderProvider
protected HeaderProvider getInternalHeaderProvider()
Gets the internal HeaderProvider that was previously set on this Builder.
-
getStreamWatchdogProvider
@Nullable public WatchdogProvider getStreamWatchdogProvider()
Gets theWatchdogProvider
that was previously set on this Builder.
-
getClock
public com.google.api.core.ApiClock getClock()
Gets the ApiClock that was previously set on this Builder.
-
getEndpoint
public String getEndpoint()
-
getMtlsEndpoint
public String getMtlsEndpoint()
-
getQuotaProjectId
public String getQuotaProjectId()
Gets the QuotaProjectId that was previously set on this Builder.
-
getStreamWatchdogCheckInterval
@Nonnull public org.threeten.bp.Duration getStreamWatchdogCheckInterval()
-
getTracerFactory
@BetaApi("The surface for tracing is not stable yet and may change in the future.") @Nonnull public ApiTracerFactory getTracerFactory()
-
applyToAllUnaryMethods
protected static void applyToAllUnaryMethods(Iterable<UnaryCallSettings.Builder<?,?>> methodSettingsBuilders, com.google.api.core.ApiFunction<UnaryCallSettings.Builder<?,?>,Void> settingsUpdater)
Applies the given settings updater function to the given method settings builders.
-
build
public abstract <B extends StubSettings<B>> StubSettings<B> build() throws IOException
- Throws:
IOException
-
-