Package io.grpc
Class NameResolver.Listener2
- java.lang.Object
-
- io.grpc.NameResolver.Listener2
-
- All Implemented Interfaces:
NameResolver.Listener
- Enclosing class:
- NameResolver
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770") public abstract static class NameResolver.Listener2 extends Object implements NameResolver.Listener
Receives address updates.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.- Since:
- 1.21.0
-
-
Constructor Summary
Constructors Constructor Description Listener2()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
onAddresses(List<EquivalentAddressGroup> servers, Attributes attributes)
Deprecated.This will be removed in 1.22.0abstract 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.Status
onResult2(NameResolver.ResolutionResult resolutionResult)
Handles updates on resolved addresses and attributes.
-
-
-
Method Detail
-
onAddresses
@Deprecated @InlineMe(replacement="this.onResult2(ResolutionResult.newBuilder().setAddressesOrError(StatusOr.fromValue(servers)).setAttributes(attributes).build())", imports={"io.grpc.NameResolver.ResolutionResult","io.grpc.StatusOr"}) public final void onAddresses(List<EquivalentAddressGroup> servers, @ResolutionResultAttr Attributes attributes)
Deprecated.This will be removed in 1.22.0Handles updates on resolved addresses and attributes.- Specified by:
onAddresses
in interfaceNameResolver.Listener
- Parameters:
servers
- the resolved server addresses. An empty list will triggerNameResolver.Listener.onError(io.grpc.Status)
attributes
- extra information from naming system.
-
onResult
public abstract void onResult(NameResolver.ResolutionResult resolutionResult)
Handles updates on resolved addresses and attributes. IfNameResolver.ResolutionResult.getAddressesOrError()
is empty,onError(Status)
will be called.- Parameters:
resolutionResult
- the resolved server addresses, attributes, and Service Config.- Since:
- 1.21.0
-
onError
public abstract void onError(Status error)
Handles a name resolving error from the resolver. The listener is responsible for eventually invokingNameResolver.refresh()
to re-attempt resolution.- Specified by:
onError
in interfaceNameResolver.Listener
- Parameters:
error
- a non-OK status- Since:
- 1.21.0
-
onResult2
public Status onResult2(NameResolver.ResolutionResult resolutionResult)
Handles updates on resolved addresses and attributes.- Parameters:
resolutionResult
- the resolved server addresses, attributes, and Service Config.- Since:
- 1.66
-
-