@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1770") public abstract static class NameResolver.Listener2 extends Object implements NameResolver.Listener
All methods are expected to return quickly.
This is a replacement API of Listener
. However, we think this new API may change
again, so we aren't yet encouraging mass-migration to it. It is fine to use and works.
Constructor and Description |
---|
Listener2() |
Modifier and Type | Method and Description |
---|---|
void |
onAddresses(List<EquivalentAddressGroup> servers,
Attributes attributes)
Deprecated.
This will be removed in 1.22.0
|
abstract void |
onError(Status error)
Handles a name resolving error from the resolver.
|
abstract void |
onResult(NameResolver.ResolutionResult resolutionResult)
Handles updates on resolved addresses and attributes.
|
@Deprecated @InlineMe(replacement="this.onResult(ResolutionResult.newBuilder().setAddresses(servers).setAttributes(attributes).build())", imports="io.grpc.NameResolver.ResolutionResult") public final void onAddresses(List<EquivalentAddressGroup> servers, @NameResolver.ResolutionResultAttr Attributes attributes)
NameResolver.Listener
Implementations will not modify the given servers
.
onAddresses
in interface NameResolver.Listener
servers
- the resolved server addresses. An empty list will trigger NameResolver.Listener.onError(io.grpc.Status)
attributes
- extra information from naming system.public abstract void onResult(NameResolver.ResolutionResult resolutionResult)
NameResolver.ResolutionResult.getAddresses()
is empty, onError(Status)
will be called.resolutionResult
- the resolved server addresses, attributes, and Service Config.public abstract void onError(Status error)
NameResolver.refresh()
to re-attempt resolution.onError
in interface NameResolver.Listener
error
- a non-OK status