Package com.google.api.gax.grpc
Class GrpcCallContext
java.lang.Object
com.google.api.gax.grpc.GrpcCallContext
- All Implemented Interfaces:
RetryingContext,ApiCallContext
@BetaApi("Reference ApiCallContext instead - this class is likely to experience breaking changes")
public final class GrpcCallContext
extends Object
implements ApiCallContext
GrpcCallContext encapsulates context data used to make a grpc call.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.api.gax.rpc.ApiCallContext
ApiCallContext.Key<T extends Object> -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic GrpcCallContextReturns an empty instance with a null channel and defaultCallOptions.booleanio.grpc.CallOptionsTheCallOptionsset on this context.io.grpc.ChannelTheChannelset on this context.The channel affinity for this context.The extra header for this context.<T> TgetOption(ApiCallContext.Key<T> key) org.threeten.bp.DurationThe stream idle timeout set for this context.org.threeten.bp.DurationThe stream wait timeout set for this context.org.threeten.bp.DurationinthashCode()merge(ApiCallContext inputCallContext) nullToSelf(ApiCallContext inputContext) Returns inputContext cast toGrpcCallContext, or an emptyGrpcCallContextif inputContext is null.static GrpcCallContextof(io.grpc.Channel channel, io.grpc.CallOptions callOptions) Returns an instance with the given channel andCallOptions.voidValidate the Universe Domain to ensure that the user configured Universe Domain and the Credentials' Universe Domain match.withCallOptions(io.grpc.CallOptions newCallOptions) Returns a new instance with the call options set to the given call options.withChannel(io.grpc.Channel newChannel) Returns a new instance with the channel set to the given channel.withChannelAffinity(Integer affinity) withCredentials(com.google.auth.Credentials newCredentials) withEndpointContext(EndpointContext endpointContext) withExtraHeaders(Map<String, List<String>> extraHeaders) <T> GrpcCallContextwithOption(ApiCallContext.Key<T> key, T value) withRequestParamsDynamicHeaderOption(String requestParams) withRetryableCodes(Set<StatusCode.Code> retryableCodes) withRetrySettings(RetrySettings retrySettings) withStreamIdleTimeout(org.threeten.bp.Duration streamIdleTimeout) withStreamWaitTimeout(org.threeten.bp.Duration streamWaitTimeout) withTimeout(org.threeten.bp.Duration timeout) withTracer(ApiTracer tracer) withTransportChannel(TransportChannel inputChannel)
-
Field Details
-
TRACER_KEY
-
-
Method Details
-
createDefault
Returns an empty instance with a null channel and defaultCallOptions. -
of
Returns an instance with the given channel andCallOptions. -
nullToSelf
Returns inputContext cast toGrpcCallContext, or an emptyGrpcCallContextif inputContext is null.- Specified by:
nullToSelfin interfaceApiCallContext- Parameters:
inputContext- theApiCallContextto cast if it is not null
-
withCredentials
- Specified by:
withCredentialsin interfaceApiCallContext
-
withTransportChannel
- Specified by:
withTransportChannelin interfaceApiCallContext
-
withEndpointContext
- Specified by:
withEndpointContextin interfaceApiCallContext
-
withTimeout
- Specified by:
withTimeoutin interfaceApiCallContext
-
getTimeout
- Specified by:
getTimeoutin interfaceApiCallContext
-
withStreamWaitTimeout
- Specified by:
withStreamWaitTimeoutin interfaceApiCallContext
-
withStreamIdleTimeout
- Specified by:
withStreamIdleTimeoutin interfaceApiCallContext
-
withChannelAffinity
@BetaApi("The surface for channel affinity is not stable yet and may change in the future.") public GrpcCallContext withChannelAffinity(@Nullable Integer affinity) -
withExtraHeaders
@BetaApi("The surface for extra headers is not stable yet and may change in the future.") public GrpcCallContext withExtraHeaders(Map<String, List<String>> extraHeaders) - Specified by:
withExtraHeadersin interfaceApiCallContext
-
getRetrySettings
- Specified by:
getRetrySettingsin interfaceRetryingContext
-
withRetrySettings
- Specified by:
withRetrySettingsin interfaceApiCallContext
-
getRetryableCodes
- Specified by:
getRetryableCodesin interfaceRetryingContext
-
withRetryableCodes
- Specified by:
withRetryableCodesin interfaceApiCallContext
-
merge
- Specified by:
mergein interfaceApiCallContext
-
getChannel
public io.grpc.Channel getChannel()TheChannelset on this context. -
getCallOptions
public io.grpc.CallOptions getCallOptions()TheCallOptionsset on this context. -
getStreamWaitTimeout
The stream wait timeout set for this context.- Specified by:
getStreamWaitTimeoutin interfaceApiCallContext- See Also:
-
getStreamIdleTimeout
The stream idle timeout set for this context.- Specified by:
getStreamIdleTimeoutin interfaceApiCallContext- See Also:
-
getChannelAffinity
The channel affinity for this context. -
getExtraHeaders
@BetaApi("The surface for extra headers is not stable yet and may change in the future.") public Map<String,List<String>> getExtraHeaders()The extra header for this context.- Specified by:
getExtraHeadersin interfaceApiCallContext
-
withChannel
Returns a new instance with the channel set to the given channel. -
withCallOptions
Returns a new instance with the call options set to the given call options. -
withRequestParamsDynamicHeaderOption
-
getTracer
- Specified by:
getTracerin interfaceApiCallContext- Specified by:
getTracerin interfaceRetryingContext
-
withTracer
- Specified by:
withTracerin interfaceApiCallContext
-
withOption
- Specified by:
withOptionin interfaceApiCallContext
-
getOption
- Specified by:
getOptionin interfaceApiCallContext
-
validateUniverseDomain
Validate the Universe Domain to ensure that the user configured Universe Domain and the Credentials' Universe Domain match. An exception will be raised if there are any issues when trying to validate (i.e. unable to access the universe domain).- Throws:
UnauthenticatedException- Thrown if the universe domain that the user configured does not match the Credential's universe domain.UnavailableException- If client library is unable to retrieve the universe domain from the Credentials and the RPC is configured to retry Unavailable exceptions, the client library will attempt to retry with the RPC's defined retry bounds. If the retry bounds have been exceeded and the library is still unable to retrieve the universe domain, the exception will be thrown back to the user.
-
hashCode
public int hashCode() -
equals
-