commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From venkat veludandi <>
Subject Commons Configuration: Using Reload Strategy
Date Sun, 15 May 2011 22:56:27 GMT
Good afternoon.
I am using commons configuration as follows:
<?xml version="1.0" encoding="UTF-8"?>
  <properties fileName="" config-name="test">
   <reloadingStrategy refreshDelay="30000"
public class CommonsConfiguration {
 private static CombinedConfiguration configuration;
 static {
  try {
   DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(new File("/var/commons_configuration.xml"));
   configuration = builder.getConfiguration(true);
  } catch (ConfigurationException e) {
 public static CombinedConfiguration getCombinedConfiguration() {
  return configuration;
When I use commons configuration as follows in any instance/static method:
String testMe= (String) CommonsConfiguration.getCombinedConfiguration().getConfiguration("test").getProperty("");
It work fine with reloading strategy. In other words when I change the property
value, the change gets reflected.
In some class I was accessing the property in a static block as follows:
public Sample {
  String testMe = String) CommonsConfiguration.getCombinedConfiguration().getConfiguration("test").getProperty("");
  //do something
If a property is accessed in static block and the property value is changed, the change does
not get reflected.
Is there any work around to access a property in static block and have the property change
I appreciate and thank you for your feed back.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message