public HerokuDiscoveryStrategy(ILogger logger, Map<String, Comparable> properties) { super(logger, properties); String serviceNamesProp = getOrNull(new SimplePropertyDefinition("serviceNames", PropertyTypeConverter.STRING)); if (serviceNamesProp == null) { String formationName = System.getenv("HEROKU_DNS_FORMATION_NAME"); if (formationName == null) { throw new IllegalArgumentException("You must enable Heroku DNS Service Discovery for this Hazelcast plugin to work!"); } else { this.serviceNames = Collections.unmodifiableCollection(Arrays.asList(formationName)); } } else { List<String> serviceNamesList = new ArrayList<>(); for (String serviceName : serviceNamesProp.split(";")) { String appName = System.getenv("HEROKU_DNS_APP_NAME"); if (appName == null) { throw new IllegalArgumentException("You must enable Heroku DNS Service Discovery for this Hazelcast plugin to work!"); } else { serviceNamesList.add(serviceName + "." + appName); } } this.serviceNames = Collections.unmodifiableCollection(serviceNamesList); } String mergeDelay = getOrNull(new SimplePropertyDefinition("mergeDelay", PropertyTypeConverter.STRING)); System.setProperty("hazelcast.merge.first.run.delay.seconds", mergeDelay == null ? "20" : mergeDelay); // TODO parse /etc/heroku/space-topology.json instead, // but that should go in a separate library Security.setProperty("networkaddress.cache.ttl", "20"); Security.setProperty("networkaddress.cache.negative.ttl", "0"); }
public ConsulDiscoveryFactory() { List<PropertyDefinition> properties = new ArrayList<>(); properties.add(new SimplePropertyDefinition("host", PropertyTypeConverter.STRING)); properties.add(new SimplePropertyDefinition("port", PropertyTypeConverter.INTEGER)); properties.add(new SimplePropertyDefinition("name", PropertyTypeConverter.STRING)); this.propertyDefinitions = Collections.unmodifiableCollection(properties); }
private static PropertyDefinition property(String key, PropertyTypeConverter typeConverter, ValueValidator valueValidator) { return new SimplePropertyDefinition(key, true, typeConverter, valueValidator); }
private static PropertyDefinition property(String key, TypeConverter typeConverter) { return new SimplePropertyDefinition(key, true, typeConverter); }