Package io.deephaven.grpc.util
Class MultiHostNameResolverProvider
java.lang.Object
io.grpc.NameResolver.Factory
io.grpc.NameResolverProvider
io.deephaven.grpc.util.MultiHostNameResolverProvider
public class MultiHostNameResolverProvider
extends io.grpc.NameResolverProvider
A gRPC
NameResolver class with configurable scheme and fixed list of hosts.
For servers that are stateless and symmetric; gRPC will do connection failover on subchannel drops and errors.
When used with a pick_first load balancer policy, the resulting behavior from gRPC will be,
hosts will be tried in order for connection starting at the first, and the first that succeeds to connect will
be used and gRPC will try to maintain the same endpoint (including transitions from IDLE back to CONNECTING and CONNECTED).
On failures the next host in the list will be attempted, considering the list as circular (with wrap around).
At most one connection at any given time will be active.
See Custom Name Resolution
in the gRPC documentation.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRequired by the service loader, which is not the intended route to use this class.MultiHostNameResolverProvider(String scheme, String serviceAuthority, boolean attrAuthorityOverrideToHost, String[] hosts, int port) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanstatic io.grpc.EquivalentAddressGroupmakeEquivalentAddressGroup(boolean attrAuthorityOverrideToHost, String host, int port) io.grpc.NameResolvernewNameResolver(URI targetUri, io.grpc.NameResolver.Args args) protected intpriority()Methods inherited from class io.grpc.NameResolverProvider
getProducedSocketAddressTypes, getScheme
-
Constructor Details
-
MultiHostNameResolverProvider
public MultiHostNameResolverProvider()Required by the service loader, which is not the intended route to use this class. Set config to null to disable this if not initialized properly. -
MultiHostNameResolverProvider
-
-
Method Details
-
isAvailable
protected boolean isAvailable()- Specified by:
isAvailablein classio.grpc.NameResolverProvider
-
priority
protected int priority()- Specified by:
priorityin classio.grpc.NameResolverProvider
-
getDefaultScheme
- Specified by:
getDefaultSchemein classio.grpc.NameResolver.Factory
-
newNameResolver
- Specified by:
newNameResolverin classio.grpc.NameResolver.Factory
-
makeEquivalentAddressGroup
public static io.grpc.EquivalentAddressGroup makeEquivalentAddressGroup(boolean attrAuthorityOverrideToHost, String host, int port)
-