Class ServiceConfigState
java.lang.Object
io.grpc.internal.ServiceConfigState
ServiceConfigState holds the state of the current service config. It must be mutated
and read from ManagedChannelImpl constructor or the provided syncContext.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NameResolver.ConfigOrErrorprivate final NameResolver.ConfigOrErrorprivate final booleanprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionServiceConfigState(ManagedChannelServiceConfig defaultServiceConfig, boolean lookUpServiceConfig) Construct new instance. -
Method Summary
Modifier and TypeMethodDescription(package private) boolean(package private) NameResolver.ConfigOrErrorGets the current service config or error.(package private) booleanReturnstrueif it RPCs should wait on a service config resolution.(package private) void
-
Field Details
-
defaultServiceConfig
-
lookUpServiceConfig
private final boolean lookUpServiceConfig -
currentServiceConfigOrError
-
updated
private boolean updated
-
-
Constructor Details
-
ServiceConfigState
ServiceConfigState(@Nullable ManagedChannelServiceConfig defaultServiceConfig, boolean lookUpServiceConfig) Construct new instance.- Parameters:
defaultServiceConfig- The initial service config, ornullif absent.lookUpServiceConfig-trueif service config updates might occur.
-
-
Method Details
-
shouldWaitOnServiceConfig
boolean shouldWaitOnServiceConfig()Returnstrueif it RPCs should wait on a service config resolution. This can returnfalseif:- There is a valid service config from the name resolver
- There is a valid default service config and a service config error from the name resolver
- No service config from the name resolver, and no intent to lookup a service config.
In the final case, the default service config may be present or absent, and will be the current service config.
-
getCurrent
Gets the current service config or error.- Throws:
IllegalStateException- if the service config has not yet been updated.
-
update
-
expectUpdates
boolean expectUpdates()
-