Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 36087 invoked from network); 14 Dec 2007 12:39:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Dec 2007 12:39:05 -0000 Received: (qmail 9014 invoked by uid 500); 14 Dec 2007 12:38:54 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 8685 invoked by uid 500); 14 Dec 2007 12:38:53 -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 8676 invoked by uid 99); 14 Dec 2007 12:38:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2007 04:38:52 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Dec 2007 12:38:39 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0C946714254 for ; Fri, 14 Dec 2007 04:38:43 -0800 (PST) Message-ID: <8382665.1197635923009.JavaMail.jira@brutus> Date: Fri, 14 Dec 2007 04:38:43 -0800 (PST) From: "Pino Navato (JIRA)" To: issues@commons.apache.org Subject: [jira] Created: (CONFIGURATION-302) FileChangedReloadingStrategy.reloadingRequired() can fail MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org FileChangedReloadingStrategy.reloadingRequired() can fail --------------------------------------------------------- Key: CONFIGURATION-302 URL: https://issues.apache.org/jira/browse/CONFIGURATION-302 Project: Commons Configuration Issue Type: Bug Affects Versions: 1.5 Reporter: Pino Navato Priority: Minor If reloadingRequired() returns true and you call it again before calling reloadingPerformed(), the 2nd time it can return false (but you have not yet reloaded!) because it doesn't check the file system again until the refresh delay is expired. Of course this is a very unusual test case (usually you reload immediately) but the behaviour of the method should be consistent in this case too: if reloadingRequired() returns true any subsequent call to this method should return true until reloadingPerformed() is called. In my project I have fixed the method by promoting the flag called "reloading" to class scope so I that can check whether the previous call returned true or false: protected boolean reloading = false; public boolean reloadingRequired() { if (!reloading) { long now = System.currentTimeMillis(); if (now > lastChecked + refreshDelay) { lastChecked = now; if (hasChanged()) { reloading = true; } } } return reloading; } Of course I reset this flag in init() and reloadingPerformed(). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.