|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.configuration.reloading.FileChangedReloadingStrategy
A reloading strategy that will reload the configuration every time its underlying file is changed. The file is not reloaded more than once every 5 seconds by default, this time can be changed by setting the refresh delay. This strategy only works with FileConfiguration instances.
Field Summary | |
protected FileConfiguration |
configuration
|
protected long |
lastChecked
The last time the file was checked for changes. |
protected long |
lastModified
The last time the configuration file was modified. |
protected long |
refreshDelay
The minimum delay in milliseconds between checks. |
Constructor Summary | |
FileChangedReloadingStrategy()
|
Method Summary | |
long |
getRefreshDelay()
Return the minimal time in milliseconds between two reloadings. |
protected boolean |
hasChanged()
Check if the configuration has changed since the last time it was loaded. |
void |
init()
Initialize the strategy. |
void |
reloadingPerformed()
Notify the strategy that the file has been reloaded. |
boolean |
reloadingRequired()
Tell if the evaluation of the strategy requires to reload the configuration. |
void |
setConfiguration(FileConfiguration configuration)
Set the configuration managed by this strategy. |
void |
setRefreshDelay(long refreshDelay)
Set the minimal time between two reloadings. |
protected void |
updateLastModified()
Update the last modified time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected FileConfiguration configuration
protected long lastModified
protected long lastChecked
protected long refreshDelay
Constructor Detail |
public FileChangedReloadingStrategy()
Method Detail |
public void setConfiguration(FileConfiguration configuration)
ReloadingStrategy
setConfiguration
in interface ReloadingStrategy
public void init()
ReloadingStrategy
init
in interface ReloadingStrategy
public boolean reloadingRequired()
ReloadingStrategy
reloadingRequired
in interface ReloadingStrategy
public void reloadingPerformed()
ReloadingStrategy
reloadingPerformed
in interface ReloadingStrategy
public long getRefreshDelay()
public void setRefreshDelay(long refreshDelay)
refreshDelay
- refresh delay in millisecondsprotected void updateLastModified()
protected boolean hasChanged()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |