Package io.grpc

Class NameResolver

    • Constructor Detail

      • NameResolver

        public NameResolver()
    • Method Detail

      • getServiceAuthority

        public abstract java.lang.String getServiceAuthority()
        Returns the authority used to authenticate connections to servers. It must be from a trusted source, because if the authority is tampered with, RPCs may be sent to the attackers which may leak sensitive user data.

        An implementation must generate it without blocking, typically in line, and must keep it unchanged. NameResolvers created from the same factory with the same argument must return the same authority.

        Since:
        1.0.0
      • start

        public void start​(NameResolver.Listener listener)
        Starts the resolution. The method is not supposed to throw any exceptions. That might cause the Channel that the name resolver is serving to crash. Errors should be propagated through NameResolver.Listener.onError(io.grpc.Status).

        An instance may not be started more than once, by any overload of this method, even after an intervening call to shutdown().

        Parameters:
        listener - used to receive updates on the target
        Since:
        1.0.0
      • start

        public void start​(NameResolver.Listener2 listener)
        Starts the resolution. The method is not supposed to throw any exceptions. That might cause the Channel that the name resolver is serving to crash. Errors should be propagated through NameResolver.Listener2.onError(io.grpc.Status).

        An instance may not be started more than once, by any overload of this method, even after an intervening call to shutdown().

        Parameters:
        listener - used to receive updates on the target
        Since:
        1.21.0
      • shutdown

        public abstract void shutdown()
        Stops the resolution. Updates to the Listener will stop.
        Since:
        1.0.0
      • refresh

        public void refresh()
        Re-resolve the name.

        Can only be called after start(io.grpc.NameResolver.Listener) has been called.

        This is only a hint. Implementation takes it as a signal but may not start resolution immediately. It should never throw.

        The default implementation is no-op.

        Since:
        1.0.0