commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Borut BolĨina <...@najdi.si>
Subject [Configuration] XMLConfiguration reloading strategy
Date Sun, 23 Oct 2005 16:24:35 GMT
Hi, this is my first posting here.

I wanted to use Commons Configuration to simplify configuration 
management in my web app. XMLConfiguration isn't reloading if file 
changes. Is this by design or is a bug? Normal properties reloading 
works as expected (setReloadingStrategy). This is my test method:

private void run() {
        try {
            XMLConfiguration config = new XMLConfiguration("Database.xml");
            config.setReloadingStrategy(new FileChangedReloadingStrategy());
            String s = "tables.table(0).name";
           
            PropertiesConfiguration config2 = new 
PropertiesConfiguration("usergui.properties");
            config2.setReloadingStrategy(new 
FileChangedReloadingStrategy());
            String s2 = "user.name";
               
            for (;;) {
                System.out.println("xml :" + config.getString(s));
                System.out.println("prop:" + config2.getString(s2));
                try {
                    Thread.sleep(5 * 1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        } catch (ConfigurationException e) {
            e.printStackTrace();
        }
    }

Regards,
Borut

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message