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.
  • 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

      public MultiHostNameResolverProvider(String scheme, String serviceAuthority, boolean attrAuthorityOverrideToHost, String[] hosts, int port)
  • Method Details

    • isAvailable

      protected boolean isAvailable()
      Specified by:
      isAvailable in class io.grpc.NameResolverProvider
    • priority

      protected int priority()
      Specified by:
      priority in class io.grpc.NameResolverProvider
    • getDefaultScheme

      public String getDefaultScheme()
      Specified by:
      getDefaultScheme in class io.grpc.NameResolver.Factory
    • newNameResolver

      public io.grpc.NameResolver newNameResolver(URI targetUri, io.grpc.NameResolver.Args args)
      Specified by:
      newNameResolver in class io.grpc.NameResolver.Factory
    • makeEquivalentAddressGroup

      public static io.grpc.EquivalentAddressGroup makeEquivalentAddressGroup(boolean attrAuthorityOverrideToHost, String host, int port)