Top Description Inners Constructors Methods
io.grpc

public abstract Class NameResolver

extends Object
Class Inheritance
Annotations
@ExperimentalApi:https://github.com/grpc/grpc-java/issues/1770
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkNotNull

A pluggable component that resolves a target URI and return addresses to the caller.

A NameResolver uses the URI's scheme to determine whether it can resolve it, and uses the components after the scheme for actual resolution.

The addresses and attributes of a target may be changed over time, thus the caller registers a Listener to receive continuous updates.

A NameResolver does not need to automatically re-resolve on failure. Instead, the Listener is responsible for eventually (after an appropriate backoff period) invoking refresh().

Implementations don't need to be thread-safe. All methods are guaranteed to be called sequentially. Additionally, all methods that have side-effects, i.e., start(Listener2), shutdown and refresh are called from the same SynchronizationContext as returned by Args#getSynchronizationContext. Do not block within the synchronization context; blocking I/O and time-consuming tasks should be offloaded to a separate thread, generally Args#getOffloadExecutor.

Since
1.0.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
NameResolver.Args

Information that a Factory uses to create a NameResolver.

public static class
NameResolver.ConfigOrError

Represents either a successfully parsed service config, containing all necessary parts to be later applied by the channel, or a Status containing the error encountered while parsing.

public abstract static class
NameResolver.Factory

Factory that creates NameResolver instances.

public static interface
NameResolver.Listener

Receives address updates.

public abstract static class
NameResolver.Listener2

Receives address updates.

public static class
NameResolver.ResolutionResult

Represents the results from a Name Resolver.

public static @interface
NameResolver.ResolutionResultAttr

Annotation for name resolution result attributes.

public abstract static class
NameResolver.ServiceConfigParser

Parses and validates service configuration.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract String
getServiceAuthority()

Returns the authority used to authenticate connections to servers.

public void
refresh()

Re-resolve the name.

public abstract void
shutdown()

Stops the resolution.

public void
start(final NameResolver.Listener
used to receive updates on the target
listener
)

Starts the resolution.

public void
start(NameResolver.Listener2
used to receive updates on the target
listener
)

Starts the resolution.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait