Class ConfigSourceSet

  • All Implemented Interfaces:
    ConfigSource

    public class ConfigSourceSet
    extends Object
    implements ConfigSource
    An immutable set of connection endpoints, where each endpoint points to either a remote config server or a config proxy. Two sets are said to be equal if they contain the same sources, independent of order, upper/lower-casing and whitespaces.
    Author:
    gjoranv
    • Constructor Detail

      • ConfigSourceSet

        public ConfigSourceSet()
        Creates an empty ConfigSourceSet, mostly used for unit testing.
      • ConfigSourceSet

        public ConfigSourceSet​(List<String> addresses)
        Creates a ConfigSourceSet containing all the unique given input addresses. Each address is trimmed and lower-cased before adding.
        Parameters:
        addresses - Connection endpoints on the format "tcp/host:port".
      • ConfigSourceSet

        public ConfigSourceSet​(String[] addresses)
        Creates a ConfigSourceSet containing all the unique given input addresses. Each address is trimmed and lower-cased before adding.
        Parameters:
        addresses - Connection endpoints on the format "tcp/host:port".
      • ConfigSourceSet

        public ConfigSourceSet​(String address)
        Convenience constructor to create a ConfigSourceSet with only one input address.
        Parameters:
        address - Connection endpoint on the format "tcp/host:port".
    • Method Detail

      • getSources

        public Set<String> getSources()
        Returns an unmodifiable set containing all sources in this ConfigSourceSet. Iteration order is guaranteed to be the same as that of the list or array that was given when this set was created.
        Returns:
        All sources in this ConfigSourceSet.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • createDefault

        public static ConfigSourceSet createDefault()
        Create a new source set using the environment variables or system properties
        Returns:
        a new source set if available, null if not.