NameResolver.Listener
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770") public abstract static class NameResolver.Listener2 extends java.lang.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 | Description |
---|---|
Listener2() |
Modifier and Type | Method | Description |
---|---|---|
void |
onAddresses(java.util.List<EquivalentAddressGroup> servers,
Attributes attributes) |
Deprecated.
This will be removed in 1.22.0
|
abstract void |
onError(Status error) |
Handles an error from the resolver.
|
abstract void |
onResult(NameResolver.ResolutionResult resolutionResult) |
Handles updates on resolved addresses and attributes.
|
@Deprecated public final void onAddresses(java.util.List<EquivalentAddressGroup> servers, @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