Package com.yahoo.config.subscription
Class ConfigSourceSet
- java.lang.Object
-
- com.yahoo.config.subscription.ConfigSourceSet
-
- All Implemented Interfaces:
ConfigSource
public class ConfigSourceSet extends java.lang.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 Summary
Constructors Constructor Description ConfigSourceSet()
Creates an empty ConfigSourceSet, mostly used for unit testing.ConfigSourceSet(java.lang.String address)
Convenience constructor to create a ConfigSourceSet with only one input address.ConfigSourceSet(java.lang.String[] addresses)
Creates a ConfigSourceSet containing all the unique given input addresses.ConfigSourceSet(java.util.List<java.lang.String> addresses)
Creates a ConfigSourceSet containing all the unique given input addresses.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConfigSourceSet
createDefault()
Create a new source set using the environment variables or system propertiesboolean
equals(java.lang.Object o)
java.util.Set<java.lang.String>
getSources()
Returns an unmodifiable set containing all sources in this ConfigSourceSet.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
ConfigSourceSet
public ConfigSourceSet()
Creates an empty ConfigSourceSet, mostly used for unit testing.
-
ConfigSourceSet
public ConfigSourceSet(java.util.List<java.lang.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(java.lang.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(java.lang.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 java.util.Set<java.lang.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.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.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.
-
-