Interface EndpointResolver<A extends Address, S, D, E>

Type Parameters:
A - the type of Address resolved
S - the type of the endpoint server
D - the type of the data managed by the resolver
E - the type of the endpoint

public interface EndpointResolver<A extends Address, S, D, E>
Endpoint resolver Service Provider Interface (SPI).

invalid @link
{@link #resolve)
} resolves an address to resolver managed state <S>. State modifying methods can be called concurrently, the implementation is responsible to manage concurrent state modifications.
  • Method Summary

    Modifier and Type
    Method
    Description
    addressOf(S server)
    Returns the socket address of a given server.
    void
    Close this resolver.
    void
    dispose(D data)
    Dispose the state.
    endpoint(D state)
    Return the current endpoint visible by the resolver.
    boolean
    isValid(D state)
    Check the state validity.
    default String
    protocolOf(S server)
    Returns the protocol id of a given server.
    default Future<D>
    refresh(A address, D state)
     
    resolve(A address, EndpointBuilder<E,S> builder)
    Resolve an address to the resolver state for this name.
    tryCast(Address address)
    Try to cast the address to an address instance that can be resolved by this resolver instance.
  • Method Details

    • tryCast

      A tryCast(Address address)
      Try to cast the address to an address instance that can be resolved by this resolver instance.
      Parameters:
      address - the address to cast
      Returns:
      the address or null when the address cannot be resolved by this resolver
    • addressOf

      SocketAddress addressOf(S server)
      Returns the socket address of a given server.
      Parameters:
      server - the server
      Returns:
      the server socket address
    • protocolOf

      default String protocolOf(S server)
      Returns the protocol id of a given server.
      Parameters:
      server - the server
      Returns:
      the protocol if of the server or null if unknown
    • resolve

      Future<D> resolve(A address, EndpointBuilder<E,S> builder)
      Resolve an address to the resolver state for this name.
      Parameters:
      address - the address to resolve
      builder - the endpoint builder
      Returns:
      a future notified with the result
    • endpoint

      E endpoint(D state)
      Return the current endpoint visible by the resolver.
      Parameters:
      state - the resolver state
      Returns:
      the list of endpoints
    • isValid

      boolean isValid(D state)
      Check the state validity.
      Parameters:
      state - resolver state
      Returns:
      the state validity
    • refresh

      default Future<D> refresh(A address, D state)
      Parameters:
      address -
      state -
      Returns:
    • dispose

      void dispose(D data)
      Dispose the state.
      Parameters:
      data - the state
    • close

      void close()
      Close this resolver.