Package io.grpc.internal
Class RetryingNameResolver
java.lang.Object
io.grpc.NameResolver
io.grpc.internal.ForwardingNameResolver
io.grpc.internal.RetryingNameResolver
This wrapper class can add retry capability to any polling
NameResolver implementation
that supports calling RetryingNameResolver.ResolutionResultListeners with the outcome of each resolution.
The NameResolver used with this
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class(package private) classSimple callback class to store inNameResolver.ResolutionResultattributes so that ManagedChannel can indicate if the resolved addresses were accepted.private classNested classes/interfaces inherited from class io.grpc.NameResolver
NameResolver.Args, NameResolver.ConfigOrError, NameResolver.Factory, NameResolver.Listener, NameResolver.Listener2, NameResolver.ResolutionResult, NameResolver.ResolutionResultAttr, NameResolver.ServiceConfigParser -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Attributes.Key<RetryingNameResolver.ResolutionResultListener> private final NameResolverprivate final RetrySchedulerprivate final SynchronizationContext -
Constructor Summary
ConstructorsConstructorDescriptionRetryingNameResolver(NameResolver retriedNameResolver, RetryScheduler retryScheduler, SynchronizationContext syncContext) Creates a newRetryingNameResolver. -
Method Summary
Modifier and TypeMethodDescription(package private) NameResolverUsed to get the underlyingNameResolverthat is getting its failed attempts retried.voidshutdown()Stops the resolution.voidstart(NameResolver.Listener2 listener) Starts the resolution.Methods inherited from class io.grpc.internal.ForwardingNameResolver
getServiceAuthority, refresh, start, toString
-
Field Details
-
retriedNameResolver
-
retryScheduler
-
syncContext
-
RESOLUTION_RESULT_LISTENER_KEY
static final Attributes.Key<RetryingNameResolver.ResolutionResultListener> RESOLUTION_RESULT_LISTENER_KEY
-
-
Constructor Details
-
RetryingNameResolver
RetryingNameResolver(NameResolver retriedNameResolver, RetryScheduler retryScheduler, SynchronizationContext syncContext) Creates a newRetryingNameResolver.- Parameters:
retriedNameResolver- ANameResolverthat will have failed attempt retried.retryScheduler- Used to schedule the retry attempts.
-
-
Method Details
-
start
Description copied from class:NameResolverStarts the resolution. The method is not supposed to throw any exceptions. That might cause the Channel that the name resolver is serving to crash. Errors should be propagated throughNameResolver.Listener2.onError(io.grpc.Status).An instance may not be started more than once, by any overload of this method, even after an intervening call to
NameResolver.shutdown().- Overrides:
startin classForwardingNameResolver- Parameters:
listener- used to receive updates on the target
-
shutdown
public void shutdown()Description copied from class:NameResolverStops the resolution. Updates to the Listener will stop.- Overrides:
shutdownin classForwardingNameResolver
-
getRetriedNameResolver
NameResolver getRetriedNameResolver()Used to get the underlyingNameResolverthat is getting its failed attempts retried.
-