in crossdc-commons/src/main/java/org/apache/solr/crossdc/common/ConfUtil.java [39:86]
public static void fillProperties(SolrZkClient solrClient, Map<String, Object> properties) {
// fill in from environment
Map<String, String> env = System.getenv();
for (ConfigProperty configKey : KafkaCrossDcConf.CONFIG_PROPERTIES) {
String val = env.get(configKey.getKey());
if (val == null) {
// try upper-case
val = env.get(configKey.getKey().toUpperCase(Locale.ROOT));
}
if (val != null) {
properties.put(configKey.getKey(), val);
}
}
// fill in from system properties
for (ConfigProperty configKey : KafkaCrossDcConf.CONFIG_PROPERTIES) {
String val = System.getProperty(configKey.getKey());
if (val != null) {
properties.put(configKey.getKey(), val);
}
}
Properties zkProps = new Properties();
if (solrClient != null) {
try {
if (solrClient.exists(System.getProperty(CrossDcConf.ZK_CROSSDC_PROPS_PATH,
CrossDcConf.CROSSDC_PROPERTIES), true)) {
byte[] data = solrClient.getData(System.getProperty(CrossDcConf.ZK_CROSSDC_PROPS_PATH,
CrossDcConf.CROSSDC_PROPERTIES), null, null, true);
if (data == null) {
log.error(CrossDcConf.CROSSDC_PROPERTIES + " file in Zookeeper has no data");
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, CrossDcConf.CROSSDC_PROPERTIES
+ " file in Zookeeper has no data");
}
zkProps.load(new ByteArrayInputStream(data));
KafkaCrossDcConf.readZkProps(properties, zkProps);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.error("Interrupted looking for CrossDC configuration in Zookeeper", e);
throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, e);
} catch (Exception e) {
log.error("Exception looking for CrossDC configuration in Zookeeper", e);
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Exception looking for CrossDC configuration in Zookeeper", e);
}
}
}