From user-return-31100-archive-asf-public=cust-asf.ponee.io@commons.apache.org Tue Feb 6 22:02:06 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id A92D3180657 for ; Tue, 6 Feb 2018 22:02:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 991FA160C45; Tue, 6 Feb 2018 21:02:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DF834160C37 for ; Tue, 6 Feb 2018 22:02:05 +0100 (CET) Received: (qmail 36497 invoked by uid 500); 6 Feb 2018 21:02:04 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 36480 invoked by uid 99); 6 Feb 2018 21:02:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Feb 2018 21:02:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 6B105C0042 for ; Tue, 6 Feb 2018 21:02:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.98 X-Spam-Level: X-Spam-Status: No, score=0.98 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Z-jStMbxfiI2 for ; Tue, 6 Feb 2018 21:02:01 +0000 (UTC) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id A79015F184 for ; Tue, 6 Feb 2018 21:02:00 +0000 (UTC) Received: from [192.168.178.20] ([178.10.204.200]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MINXr-1ehnCQ3KBj-004809 for ; Tue, 06 Feb 2018 22:01:53 +0100 Subject: Re: [configuration] Reloading properties does not work as expected To: user@commons.apache.org References: <34fc5a7f-97d3-0ac5-1c62-bba82121b30a@oliver-heger.de> From: Oliver Heger Message-ID: Date: Tue, 6 Feb 2018 22:01:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:cGkYnASX7+NHqUKEESN8Zrph4bIQCd87llglkIpRwdWA5BfDAyb qu8Klu/LjcOQ+VUp27IGSvDVIubdXkUqZq0yWWfAbN4E+WgM8Gs5Xwt8t5mrJydKkWrf7Nl 3yGzprDic7LTtQKmjvhSProwwdTPH2Ll2u65SHDKTJrd0/qkm9OOTYgw7fWuH3R8H52Q3P8 XXG1Tp6HXM/1oITSev+gA== X-UI-Out-Filterresults: notjunk:1;V01:K0:mwDcGWNaeIw=:NL7pEnim70fRC93KMAhV8I 0RUC0/ZyJ1dxhAVnuuPL59W82jpUIERsV0wu27ZehAejqI35KN+tOrqLFmqeejrAAwp3ALaWh s1Vs6R2U3A7GYhUNcmPEU3fEeP0+GXi1YsSv6GrwyKLUoCXxzDPnk+vcedQ9RZUzX9pIC2Esk HqelXqPh2gJnW+XANmwflYascS+82fYR/H0aL6TpcW3f3vUPa4/Pg3iW5b35nd//EN27rO0My YH2HxxfJPLkSZrMgMmblgzzxl+36alLVqdgi4BBx/11jyXGdHGtopDBC4Dwaw+YdBj6HcCWVn qoki1n6wKk/N3JRVZwMn3Ti4zLv9kxcWhwiSCHUjtVfe/Cs7VWa5WNNpnvBdbgLK4MrGg6be3 4fXjOQmsQYcFu8Wu039Z8Fy3nLUp3n8l0GKLDAO4H9ia9lxUrf4HC7+Jx7cov91bX0YITqq2Q G5WyGIs2gPVo55+TZpTdJ8p2pPfnYxYDnbNMvKmXYq+owo31zaFSqKajukJjHmFFEXiQ/IJFB wACfHCrDlsvkZ75aG75n4Nch0pgjl5hfsDd+pDx07SV90pTAikkh8cfhsoB5195fZvjIdiNhX Gig2JlJEDU6QIcBDmS/+OdALr4tDiXo4qto1si2OrHxrVtAQzUvuDRVcKEyF54R2gjR4Z+Bx1 y3ZDmw1MmAnYrKXdlwF0AtvF+BBKDdQ8Csiu03kj9IZRnriPB4KazLdLPaYff/rh2z6KZytUZ UfFp5khYi2FfOTF1FZLF4Ywf3bo2riS0LvAJX8NzXVWh86+tbbUynLA8bk0= Hi, the reloading examples have been fixed, and the site was redeployed. Thanks again. Oliver Am 01.02.2018 um 10:26 schrieb Paul Wellner Bou: > Hi, > > thank you very much. > > Yes, this helps. This is more or less what I found out as well. That's why > I introduced the 6 seconds delay in my original example, to wait for this > 5s timeout. > I tried to call getProperty more than once, too, because I noticed > debugging that the check time is only filled after the first call. > > But somehow I wrote my test code in a way, that the reloading time was the > same as the time the file changed (which may happen in unit tests, its the > same millisecond). So the test failed again. > > Now I reordered the statements a bit, and it works now. I just need to add > a call in the very beginning of the test. The timeouts I introduced in the > first approach are already enough. > > So it works now. Thanks very much! > https://gist.github.com/paulwellnerbou/dfed371d67e2f19a699b248ebf5c62d7 > >> i am trying to implement a reloadable property using commons-reloading2 >>> (2.2), without success. I tried to follow the (outdated) examples on >>> >> https://commons.apache.org/proper/commons-configuration/userguide/howto_reloading.html#Reloading_File-based_Configurations >>> (both of them). >> >> Could you be a bit more specific about what is outdated, so that we can >> update the examples? >> > > Sure: > https://gist.github.com/paulwellnerbou/3e309535a8a516477dc2bede478f79f2/revisions > Maybe you could add that commons-beanutils:1.9.3 is required to avoid the > NoClassDefFoundException ( > https://stackoverflow.com/questions/16266047/very-simple-apache-commons-configuration-example-throws-noclassdeffounderror > ). > > Cheers, > Paul. > >> >>> Now I created a unit test against this API which I would expect it to >> pass, >>> but it doesn't: >>> https://gist.github.com/paulwellnerbou/dfed371d67e2f19a699b248ebf5c62d7 >>> >>> Any idea what I am doing wrong? >> >> I had a deeper look at the test and the implementation, and here is what >> I found out: >> >> The class for checking whether a reload of a file is required is >> FileHandlerReloadingDetector. The class records the time of the last >> check and has a refreshDelay property; it only checks again after the >> time configured for the delay is elapsed. The default refreshDelay is 5 >> seconds. This is one reason why your test does not pass; you need to >> decrease this delay or wait longer. >> >> The other reason is that there is indeed a problem in the implementation >> that causes the first call to getConfiguration() to get missed by the >> reload checker. The CONFIGURATION_REQUEST event is already fired before >> the file to be loaded is properly initialized, and therefore, the >> checker cannot set its last check time. This is initialized only at the >> second call to getConfiguration(). So the test would only be successful >> if getConfiguration() was called another time (taking the refresh delay >> into account). >> >> This can be considered a bug, but is probably not very problematic in >> practice when the configuration is accessed on a regular basis. >> >> HTH >> Oliver >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org