Loading...

commons-user@jakarta.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: commons-configuration Oliver Heger Tue Oct 24 18:01:14 2006

David J. M. Karlsen wrote:
Hi!

I have the following bit of code:

propConfig = new PropertiesConfiguration( configFilename );

FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy() {
            //FIXME - never called!? why?
            public void reloadingPerformed()
            {
                LOG.warn( "Reloading configuration" );
                super.reloadingPerformed();
                try {
                    afterPropertiesSet();
                }
                catch ( Exception e ) {
                    LOG.error( e );
throw new NestableRuntimeException( e.getMessage(), e );
                }
            }
            };

        reloadingStrategy.setRefreshDelay( refreshDelay );
        propConfig.setReloadingStrategy( reloadingStrategy );


But for some reason reloadingPerformed is never called if I change the file).

I'm calling getProperty("dummy") in each iteration (rest of code) - so polling should happen.

What am I doing wrong?


Hm,

I cannot see anything wrong with your code, so I can only give some hints for debugging the problem.

- You could try to register a ConfigurationListener at the properties configuration to check whether a reload event is triggered.
- Did you check whether you really change the correct configuration file?
- What's the value of refreshDelay? If it is too big, a reload won't happen.

HTH
Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]