30
30
31
31
import static java .util .Collections .emptyList ;
32
32
33
+ /**
34
+ * An implementation of {@link UnicastHostsProvider} that reads hosts/ports
35
+ * from the "discovery.zen.ping.unicast.hosts" node setting. If the port is
36
+ * left off an entry, a default port of 9300 is assumed.
37
+ *
38
+ * An example unicast hosts setting might look as follows:
39
+ * [67.81.244.10, 67.81.244.11:9305, 67.81.244.15:9400]
40
+ */
33
41
public class SettingsBasedHostsProvider extends AbstractComponent implements UnicastHostsProvider {
34
42
35
43
public static final Setting <List <String >> DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING =
36
- Setting .listSetting ("discovery.zen.ping.unicast.hosts" , emptyList (), Function .identity (),
37
- Setting .Property .NodeScope );
44
+ Setting .listSetting ("discovery.zen.ping.unicast.hosts" , emptyList (), Function .identity (), Setting .Property .NodeScope );
38
45
39
46
// these limits are per-address
40
47
public static final int LIMIT_FOREIGN_PORTS_COUNT = 1 ;
@@ -49,7 +56,7 @@ public SettingsBasedHostsProvider(Settings settings, TransportService transportS
49
56
50
57
if (DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING .exists (settings )) {
51
58
configuredHosts = DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING .get (settings );
52
- // we only limit to 1 addresses , makes no sense to ping 100 ports
59
+ // we only limit to 1 address , makes no sense to ping 100 ports
53
60
limitPortCounts = LIMIT_FOREIGN_PORTS_COUNT ;
54
61
} else {
55
62
// if unicast hosts are not specified, fill with simple defaults on the local machine
0 commit comments