@BetaApi(value="Reference ApiCallContext instead - this class is likely to experience breaking changes") public final class GrpcCallContext extends Object implements com.google.api.gax.rpc.ApiCallContext
GrpcCallContext is immutable in the sense that none of its methods modifies the
GrpcCallContext itself or the underlying data. Methods of the form withX
, such as withTransportChannel(com.google.api.gax.rpc.TransportChannel)
, return copies of the object, but with one field changed. The immutability
and thread safety of the arguments solely depends on the arguments themselves.
Modifier and Type | Method and Description |
---|---|
static GrpcCallContext |
createDefault()
Returns an empty instance with a null channel and default
CallOptions . |
boolean |
equals(Object o) |
io.grpc.CallOptions |
getCallOptions()
The
CallOptions set on this context. |
io.grpc.Channel |
getChannel()
The
Channel set on this context. |
Integer |
getChannelAffinity()
The channel affinity for this context.
|
Map<String,List<String>> |
getExtraHeaders()
The extra header for this context.
|
<T> T |
getOption(com.google.api.gax.rpc.ApiCallContext.Key<T> key) |
Set<com.google.api.gax.rpc.StatusCode.Code> |
getRetryableCodes() |
com.google.api.gax.retrying.RetrySettings |
getRetrySettings() |
org.threeten.bp.Duration |
getStreamIdleTimeout()
The stream idle timeout set for this context.
|
org.threeten.bp.Duration |
getStreamWaitTimeout()
The stream wait timeout set for this context.
|
org.threeten.bp.Duration |
getTimeout() |
com.google.api.gax.tracing.ApiTracer |
getTracer() |
int |
hashCode() |
com.google.api.gax.rpc.ApiCallContext |
merge(com.google.api.gax.rpc.ApiCallContext inputCallContext) |
GrpcCallContext |
nullToSelf(com.google.api.gax.rpc.ApiCallContext inputContext)
Returns inputContext cast to
GrpcCallContext , or an empty GrpcCallContext if
inputContext is null. |
static GrpcCallContext |
of(io.grpc.Channel channel,
io.grpc.CallOptions callOptions)
Returns an instance with the given channel and
CallOptions . |
GrpcCallContext |
withCallOptions(io.grpc.CallOptions newCallOptions)
Returns a new instance with the call options set to the given call options.
|
GrpcCallContext |
withChannel(io.grpc.Channel newChannel)
Returns a new instance with the channel set to the given channel.
|
GrpcCallContext |
withChannelAffinity(Integer affinity) |
GrpcCallContext |
withCredentials(com.google.auth.Credentials newCredentials) |
GrpcCallContext |
withExtraHeaders(Map<String,List<String>> extraHeaders) |
<T> GrpcCallContext |
withOption(com.google.api.gax.rpc.ApiCallContext.Key<T> key,
T value) |
GrpcCallContext |
withRequestParamsDynamicHeaderOption(String requestParams) |
GrpcCallContext |
withRetryableCodes(Set<com.google.api.gax.rpc.StatusCode.Code> retryableCodes) |
GrpcCallContext |
withRetrySettings(com.google.api.gax.retrying.RetrySettings retrySettings) |
GrpcCallContext |
withStreamIdleTimeout(org.threeten.bp.Duration streamIdleTimeout) |
GrpcCallContext |
withStreamWaitTimeout(org.threeten.bp.Duration streamWaitTimeout) |
GrpcCallContext |
withTimeout(org.threeten.bp.Duration timeout) |
GrpcCallContext |
withTracer(com.google.api.gax.tracing.ApiTracer tracer) |
GrpcCallContext |
withTransportChannel(com.google.api.gax.rpc.TransportChannel inputChannel) |
public static GrpcCallContext createDefault()
CallOptions
.public static GrpcCallContext of(io.grpc.Channel channel, io.grpc.CallOptions callOptions)
CallOptions
.public GrpcCallContext nullToSelf(com.google.api.gax.rpc.ApiCallContext inputContext)
GrpcCallContext
, or an empty GrpcCallContext
if
inputContext is null.nullToSelf
in interface com.google.api.gax.rpc.ApiCallContext
inputContext
- the ApiCallContext
to cast if it is not nullpublic GrpcCallContext withCredentials(com.google.auth.Credentials newCredentials)
withCredentials
in interface com.google.api.gax.rpc.ApiCallContext
public GrpcCallContext withTransportChannel(com.google.api.gax.rpc.TransportChannel inputChannel)
withTransportChannel
in interface com.google.api.gax.rpc.ApiCallContext
public GrpcCallContext withTimeout(@Nullable org.threeten.bp.Duration timeout)
withTimeout
in interface com.google.api.gax.rpc.ApiCallContext
@Nullable public org.threeten.bp.Duration getTimeout()
getTimeout
in interface com.google.api.gax.rpc.ApiCallContext
public GrpcCallContext withStreamWaitTimeout(@Nullable org.threeten.bp.Duration streamWaitTimeout)
withStreamWaitTimeout
in interface com.google.api.gax.rpc.ApiCallContext
public GrpcCallContext withStreamIdleTimeout(@Nullable org.threeten.bp.Duration streamIdleTimeout)
withStreamIdleTimeout
in interface com.google.api.gax.rpc.ApiCallContext
@BetaApi(value="The surface for channel affinity is not stable yet and may change in the future.") public GrpcCallContext withChannelAffinity(@Nullable Integer affinity)
@BetaApi(value="The surface for extra headers is not stable yet and may change in the future.") public GrpcCallContext withExtraHeaders(Map<String,List<String>> extraHeaders)
withExtraHeaders
in interface com.google.api.gax.rpc.ApiCallContext
public com.google.api.gax.retrying.RetrySettings getRetrySettings()
getRetrySettings
in interface com.google.api.gax.retrying.RetryingContext
public GrpcCallContext withRetrySettings(com.google.api.gax.retrying.RetrySettings retrySettings)
withRetrySettings
in interface com.google.api.gax.rpc.ApiCallContext
public Set<com.google.api.gax.rpc.StatusCode.Code> getRetryableCodes()
getRetryableCodes
in interface com.google.api.gax.retrying.RetryingContext
public GrpcCallContext withRetryableCodes(Set<com.google.api.gax.rpc.StatusCode.Code> retryableCodes)
withRetryableCodes
in interface com.google.api.gax.rpc.ApiCallContext
public com.google.api.gax.rpc.ApiCallContext merge(com.google.api.gax.rpc.ApiCallContext inputCallContext)
merge
in interface com.google.api.gax.rpc.ApiCallContext
public io.grpc.Channel getChannel()
Channel
set on this context.public io.grpc.CallOptions getCallOptions()
CallOptions
set on this context.@BetaApi(value="The surface for streaming is not stable yet and may change in the future.") @Nullable public org.threeten.bp.Duration getStreamWaitTimeout()
getStreamWaitTimeout
in interface com.google.api.gax.rpc.ApiCallContext
ApiCallContext.withStreamWaitTimeout(Duration)
@BetaApi(value="The surface for streaming is not stable yet and may change in the future.") @Nullable public org.threeten.bp.Duration getStreamIdleTimeout()
getStreamIdleTimeout
in interface com.google.api.gax.rpc.ApiCallContext
ApiCallContext.withStreamIdleTimeout(Duration)
@BetaApi(value="The surface for channel affinity is not stable yet and may change in the future.") @Nullable public Integer getChannelAffinity()
@BetaApi(value="The surface for extra headers is not stable yet and may change in the future.") public Map<String,List<String>> getExtraHeaders()
getExtraHeaders
in interface com.google.api.gax.rpc.ApiCallContext
public GrpcCallContext withChannel(io.grpc.Channel newChannel)
public GrpcCallContext withCallOptions(io.grpc.CallOptions newCallOptions)
public GrpcCallContext withRequestParamsDynamicHeaderOption(String requestParams)
@Nonnull public com.google.api.gax.tracing.ApiTracer getTracer()
getTracer
in interface com.google.api.gax.retrying.RetryingContext
getTracer
in interface com.google.api.gax.rpc.ApiCallContext
public GrpcCallContext withTracer(@Nonnull com.google.api.gax.tracing.ApiTracer tracer)
withTracer
in interface com.google.api.gax.rpc.ApiCallContext
public <T> GrpcCallContext withOption(com.google.api.gax.rpc.ApiCallContext.Key<T> key, T value)
withOption
in interface com.google.api.gax.rpc.ApiCallContext
public <T> T getOption(com.google.api.gax.rpc.ApiCallContext.Key<T> key)
getOption
in interface com.google.api.gax.rpc.ApiCallContext