if (embeddedJmxTrans == null) {
if (configurationUrls == null) {
configurationUrls = Collections.singletonList(DEFAULT_CONFIGURATION_URL);
}
ConfigurationParser parser = new ConfigurationParser();
SpringEmbeddedJmxTrans newJmxTrans = new SpringEmbeddedJmxTrans();
newJmxTrans.setObjectName("org.jmxtrans.embedded:type=EmbeddedJmxTrans,name=" + beanName);
for (String delimitedConfigurationUrl : configurationUrls) {
String[] tokens = StringUtils.commaDelimitedListToStringArray(delimitedConfigurationUrl);
tokens = StringUtils.trimArrayElements(tokens);
for (String configurationUrl : tokens) {
configurationUrl = configurationUrl.trim();
logger.debug("Load configuration {}", configurationUrl);
Resource configuration = resourceLoader.getResource(configurationUrl);
if (configuration.exists()) {
try {
parser.mergeEmbeddedJmxTransConfiguration(configuration.getInputStream(), newJmxTrans);
} catch (Exception e) {
throw new EmbeddedJmxTransException("Exception loading configuration " + configuration, e);
}
} else if (ignoreConfigurationNotFound) {
logger.debug("Ignore missing configuration file {}", configuration);