commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Lucas (JIRA)" <>
Subject [jira] [Commented] (CONFIGURATION-532) FileChangedReloadingStrategy should support reloading of rolled-back (older timestamp) files
Date Tue, 12 Mar 2013 21:39:13 GMT


Mike Lucas commented on CONFIGURATION-532:

I will probably implement one of the above options as a custom subclass for my current project,
and happy to contribute that as a patch (if it's deemed useful). So if someone can comment
one which option they'd prefer (a subclass that always reloads on rollbacks vs. setting a
control property on the strategy instance), I'll work in that direction.

I'm currently leaning toward the {{setReloadOnRollback()}} option.

Also, I should point out that expectations of rollback behaviour may be more prevalent at
my company because I had written a custom {{AutoReloadingProperties}} class a long time ago
(not nearly as elegant as Commons Config but virtually the same behaviour, including the refresh
delay), and it used a != comparison to decide if it should reload.
> FileChangedReloadingStrategy should support reloading of rolled-back (older timestamp)
> --------------------------------------------------------------------------------------------
>                 Key: CONFIGURATION-532
>                 URL:
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: File reloading
>    Affects Versions: 1.9
>            Reporter: Mike Lucas
>   Original Estimate: 48h
>  Remaining Estimate: 48h
> Currently the {{FileChangedReloadingStrategy}} only reloads when the timestamp of the
file on the filesystem is _newer_ than the timestamp it had when it was last loaded.
> This may not be the expected behaviour when, for example, an administrator makes a backup
copy of the original configuration file before making changes. If the administrator wants
to roll back to the original configuration, he may expect that copying/renaming the backup
back to the original name, would cause the original configuration to take effect again.
> Another example where the current behaviour is problematic is when using a Deploy System
(like we do at my company). We expect to be able to roll-back to a previous configuration
by simply redeploying the Config artifact, but because the timestamps reflect when the Config
artifact was _built_ (not when it was deployed), this roll-back will not work.
> The current behaviour could be kept as the default, simply adding {{setReloadOnRollback()}}
or similarly named method to change the behaviour to reload when the timestamp is either older
or newer (i.e. not equal to) the {{lastModified}} variable. Another option would to be to
create subclass {{FileChangedOrRolledBackReloadingStrategy}} that overrides the {{hasChanged()}}
> In either option the actual change is to use {{!=}} instead of {{>}} in the {{hasChanged}}
method's comparison:
> {code}
> return file.lastModified() > lastModified;
> {code}

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message