Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 33E86DFC0 for ; Wed, 13 Mar 2013 21:10:14 +0000 (UTC) Received: (qmail 76184 invoked by uid 500); 13 Mar 2013 21:10:13 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 76112 invoked by uid 500); 13 Mar 2013 21:10:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 76065 invoked by uid 99); 13 Mar 2013 21:10:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Mar 2013 21:10:13 +0000 Date: Wed, 13 Mar 2013 21:10:13 +0000 (UTC) From: "Oliver Heger (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CONFIGURATION-532) FileChangedReloadingStrategy should support reloading of rolled-back (older timestamp) files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CONFIGURATION-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13601640#comment-13601640 ] Oliver Heger commented on CONFIGURATION-532: -------------------------------------------- Your request perfectly makes sense to me. The documentation of {{FileChangedReloadingStrategy}} says {quote} A reloading strategy that will reload the configuration every time its underlying file is changed. {quote} So one could argue that the current behavior to detect only newer files is actually a bug. I think when the class was created the author had the assumption that somehow modifying the configuration file would always result in a newer timestamp which is obviously not the case. So shouldn't we in general use a != comparison? > FileChangedReloadingStrategy should support reloading of rolled-back (older timestamp) files > -------------------------------------------------------------------------------------------- > > Key: CONFIGURATION-532 > URL: https://issues.apache.org/jira/browse/CONFIGURATION-532 > 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()}} method. > 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: http://www.atlassian.com/software/jira