Class ConfigurableLocalAddressProvider

All Implemented Interfaces:
AddressProvider, DescribableAddressProvider, SocketAddressProvider, Iterable, Collection, Set

public class ConfigurableLocalAddressProvider extends ConfigurableAddressProvider
ConfigurableLocalAddressProvider is an AddressProvider which is only capable of returning local addresses.

As is it known that only local addresses can be returned, this provider supports some formats not supported by the ConfigurableAddressProvider, namely empty and null hostnames are assumed to be equal to "localhost". Additionally, the hostname string may be in CIDR format (e.g. subnet/mask) allowing the provider to choose a matching local address.

Since:
Coherence 3.7.1
Author:
mf 2011.06.13
  • Constructor Details

    • ConfigurableLocalAddressProvider

      @Deprecated public ConfigurableLocalAddressProvider(XmlElement xmlConfig)
      Deprecated.
      Construct an instance of ConfigurableLocalAddressProvider based on the specified XML element.

      Unresolvable addresses will be skipped.

      Parameters:
      xmlConfig - the XML element that contains the configuration info
    • ConfigurableLocalAddressProvider

      public ConfigurableLocalAddressProvider(Iterable<ConfigurableAddressProvider.AddressHolder> addressHolders, boolean fSafe)
      Constructs a ConfigurableLocalAddressProvider using the specified ConfigurableAddressProvider.AddressHolders.
      Parameters:
      addressHolders - the ConfigurableAddressProvider.AddressHolders
      fSafe - true if the provider skips unresolved addresses
    • ConfigurableLocalAddressProvider

      public ConfigurableLocalAddressProvider(int nPort)
      Constructs a ConfigurableLocalAddressProvider for all local IPs and the given port.
    • ConfigurableLocalAddressProvider

      @Deprecated public ConfigurableLocalAddressProvider(XmlElement xmlConfig, boolean fSafe)
      Deprecated.
      Construct an instance of ConfigurableLocalAddressProvider based on the specified XML element.
      Parameters:
      xmlConfig - the XML element that contains the configuration info
      fSafe - true if the provider is skips unresolved addresses
  • Method Details

    • resolveAddress

      protected Iterator<InetSocketAddress> resolveAddress(String sHost, int nPort)
      Resolve an address and port.
      Overrides:
      resolveAddress in class ConfigurableAddressProvider
      Parameters:
      sHost - the host
      nPort - the port
      Returns:
      the InetSocketAddress
    • builder

      public static AddressProviderBuilder builder(int nPort)
      Return a builder which will produce Providers for all local addresses and the specified port
      Parameters:
      nPort - the port
      Returns:
      the builder