commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: commons-configuration
Date Tue, 24 Oct 2006 19:48:02 GMT
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message