List of usage examples for org.apache.commons.configuration.reloading FileChangedReloadingStrategy setRefreshDelay
public void setRefreshDelay(long refreshDelay)
From source file:org.overlord.commons.config.configurator.AbstractPropertiesFileConfigurator.java
/** * @see org.overlord.commons.config.configurator.Configurator#provideConfiguration(java.lang.String, java.lang.Long) *//*from ww w . j av a 2 s.co m*/ @Override public Configuration provideConfiguration(String configName, Long refreshDelay) throws ConfigurationException { URL url = findConfigUrl(configName); if (url != null) { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(url); FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy(); fileChangedReloadingStrategy.setRefreshDelay(refreshDelay); propertiesConfiguration.setReloadingStrategy(fileChangedReloadingStrategy); return propertiesConfiguration; } else { return null; } }
From source file:org.pentaho.hadoop.PropertiesConfigurationProperties.java
private static PropertiesConfiguration initPropertiesConfiguration(FileObject fileObject) throws FileSystemException, ConfigurationException { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(fileObject.getURL()); propertiesConfiguration.setAutoSave(true); FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy(); fileChangedReloadingStrategy.setRefreshDelay(1000L); propertiesConfiguration.setReloadingStrategy(fileChangedReloadingStrategy); return propertiesConfiguration; }
From source file:org.unitime.timetable.util.MessageResources.java
private Configuration getConfiguration(String name) { Configuration configuration = null; URL url = Thread.currentThread().getContextClassLoader().getResource(name); if (url != null) { PropertiesConfiguration pc = new PropertiesConfiguration(); pc.setURL(url);/*from w w w . j a v a2 s . c o m*/ // Set reloading strategy String dynamicReload = ApplicationProperties.getProperty("tmtbl.properties.dynamic_reload", null); if (dynamicReload != null && dynamicReload.equalsIgnoreCase("true")) { long refreshDelay = Constants.getPositiveInteger( ApplicationProperties.getProperty("tmtbl.properties.dynamic_reload_interval"), 15000); FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy(); strategy.setRefreshDelay(refreshDelay); pc.setReloadingStrategy(strategy); pc.addConfigurationListener(new MessageResourcesCfgListener(pc.getBasePath())); } try { pc.load(); configuration = pc; } catch (ConfigurationException e) { Debug.error("Message Resources configuration exception: " + e.getMessage()); } } return configuration; }
From source file:org.wso2.carbon.device.mgt.iot.agent.kura.display.config.ConfigManager.java
private HierarchicalConfiguration loadConfigFile(File configXmlFileName) throws ConfigurationException { XMLConfiguration config = null;//from w w w . j a v a2 s .c o m config = new XMLConfiguration(configXmlFileName); FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy(); strategy.setRefreshDelay(config.getInt(ConfigConstants.CONFIG_REFRESH_DELAY, 5000)); config.setReloadingStrategy(strategy); return config; }