问题描述
代码部署在Linux服务器上,因为需要长期修改或者添加数据,使用commons-configuration-1.10.jar
org.apache.commons.configuration.reloading.FileChangedReloadingStrategy来实现动态加载配置文件,避免重复的重启服务器,但有时会出现跟新配置文件以后,跟新的数据没有生效,重启服务器后配置文件生效。
问题原因
FileChangedReloadingStrategy()方法的描述:
/**
* <p>A reloading strategy that will reload the configuration every time its
* underlying file is changed.</p>
* <p>This reloading strategy does not actively monitor a configuration file,
* but is triggered by its associated configuration whenever properties are
* accessed. It then checks the configuration file's last modification date
* and causes a reload if this has changed.</p>
* <p>To avoid permanent disc access on successive property lookups a refresh
* delay can be specified. This has the effect that the configuration file's
* last modification date is only chec