public class StaticNameResolver
extends io.grpc.NameResolver
NameResolver
that will always respond with a static set of target addresses.io.grpc.NameResolver.Args, io.grpc.NameResolver.ConfigOrError, io.grpc.NameResolver.Factory, io.grpc.NameResolver.Listener, io.grpc.NameResolver.Listener2, io.grpc.NameResolver.ResolutionResult, io.grpc.NameResolver.ResolutionResultAttr, io.grpc.NameResolver.ServiceConfigParser
Constructor and Description |
---|
StaticNameResolver(String authority,
Collection<io.grpc.EquivalentAddressGroup> targets)
Creates a static name resolver with multiple target servers.
|
StaticNameResolver(String authority,
io.grpc.EquivalentAddressGroup target)
Creates a static name resolver with only a single target server.
|
StaticNameResolver(String authority,
io.grpc.NameResolver.ResolutionResult result)
Creates a static name resolver with multiple target servers.
|
Modifier and Type | Method and Description |
---|---|
String |
getServiceAuthority() |
void |
refresh() |
void |
shutdown() |
void |
start(io.grpc.NameResolver.Listener2 listener) |
String |
toString() |
public StaticNameResolver(String authority, io.grpc.EquivalentAddressGroup target)
authority
- The authority this name resolver was created for.target
- The target address of the server to use.public StaticNameResolver(String authority, Collection<io.grpc.EquivalentAddressGroup> targets)
authority
- The authority this name resolver was created for.targets
- The target addresses of the servers to use.public StaticNameResolver(String authority, io.grpc.NameResolver.ResolutionResult result)
authority
- The authority this name resolver was created for.result
- The resolution result to use..public String getServiceAuthority()
getServiceAuthority
in class io.grpc.NameResolver
public void start(io.grpc.NameResolver.Listener2 listener)
start
in class io.grpc.NameResolver
public void refresh()
refresh
in class io.grpc.NameResolver
public void shutdown()
shutdown
in class io.grpc.NameResolver