Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5814410102 for ; Sat, 22 Mar 2014 23:56:14 +0000 (UTC) Received: (qmail 45490 invoked by uid 500); 22 Mar 2014 23:56:11 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 45288 invoked by uid 500); 22 Mar 2014 23:56:10 -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 45280 invoked by uid 99); 22 Mar 2014 23:56:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Mar 2014 23:56:10 +0000 X-ASF-Spam-Status: No, hits=3.2 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mgainty@hotmail.com designates 65.55.116.86 as permitted sender) Received: from [65.55.116.86] (HELO blu0-omc3-s11.blu0.hotmail.com) (65.55.116.86) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Mar 2014 23:56:05 +0000 Received: from BLU172-W52 ([65.55.116.73]) by blu0-omc3-s11.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Sat, 22 Mar 2014 16:55:44 -0700 X-TMN: [MvnAA1eMbv8ucORcS1XZLOM1VBQCaANM] X-Originating-Email: [mgainty@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="_19211ae4-60dd-4829-a788-11cc517f54e5_" From: Martin Gainty To: Commons Users List Subject: RE: [configuration] Calling getConfiguration on DefaultConfigurationBuilder more than once permitted Date: Sat, 22 Mar 2014 19:55:43 -0400 Importance: Normal In-Reply-To: <532E0302.1040401@gmx.net> References: <532CB2F9.9040109@gmx.net> ,<532E0302.1040401@gmx.net> MIME-Version: 1.0 X-OriginalArrivalTime: 22 Mar 2014 23:55:44.0253 (UTC) FILETIME=[3CF89AD0:01CF462A] X-Virus-Checked: Checked by ClamAV on apache.org --_19211ae4-60dd-4829-a788-11cc517f54e5_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 > Date: Sat=2C 22 Mar 2014 22:39:14 +0100 > From: dont_know@gmx.net > To: user@commons.apache.org > Subject: Re: [configuration] Calling getConfiguration on DefaultConfigura= tionBuilder more than once permitted >=20 > Hi Martin=2C >=20 > I found a solution which fits my requirements without this ugly=20 > behaviour as described before. The trick is to configure the reloading=20 > strategy and force the reload checking in "config.xml": > >=20 > >
> >
>=20 MG>lets find out what forceReloadCheck and what it does MG>/commons-configuration>grep -r -l forceReloadCheck *.* .\src\main\java\org\apache\commons\configuration\CombinedConfiguration.java .\target\classes\org\apache\commons\configuration\CombinedConfiguration.cla= ss MG>forceReloadCheck has NO effect on DefaultConfigurationBuilder.getConfigu= ration() protected CombinedConfiguration createAdditionalsConfiguration( CombinedConfiguration resultConfig) { CombinedConfiguration addConfig =3D new CombinedConfiguration(new UnionCombiner())=3B //this will STIL= L pull UNION of entities addConfig.setDelimiterParsingDisabled(resultConfig .isDelimiterParsingDisabled())=3B addConfig.setForceReloadCheck(resultConfig.isForceReloadCheck())=3B addConfig.setIgnoreReloadExceptions(resultConfig .isIgnoreReloadExceptions())=3B return addConfig=3B } MG>if this was chess ..i have just taken your queen MG>your move.. >
>=20 > That just made my day :) >=20 > Thanks for your effort > Stefan >=20 > Am 22.03.2014 02:17=2C schrieb Martin Gainty: > >=20 > > > > > >> Date: Fri=2C 21 Mar 2014 22:45:29 +0100 > >> From: dont_know@gmx.net > >> To: user@commons.apache.org > >> Subject: [configuration] Calling getConfiguration on DefaultConfigurat= ionBuilder more than once permitted > >> > >> Hi=2C > >> > >> is it permitted to call getConfiguration more than once on the same > >> instance of DefaultConfigurationBuilder like this: > >> > >> DefaultConfigurationBuilder builder =3D new DefaultConfigurationBuilde= r()=3B > >> builder.setFile(new File("config.xml"))=3B > >> Configuration config =3D builder.getConfiguration(true)=3B > >> config =3D builder.getConfiguration(true)=3B > >> config =3D builder.getConfiguration(true)=3B > >> ... > >> > >> The config.xml looks like this: > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> and the referenced file "test.properties" contains: > >> a=3Da > >> b=3Db > >> c=3Dc > >> > >> I asked this question=2C because with the first call of getConfigurati= on > >> the "test.properties"-file is read 10 times (once for every > >> "config-at")=2C with the second call 20 times=2C with the third call 3= 0 > >> times and so on. So in the end the program slows down and after 100 > >> calls it needs 200ms to read the properties. > >=20 > > MG>builder.getConfiguration(true) a Union between one DB Table and anot= her DB Table > > MG>if you want to 'merge' 2 groups together I suggest using OverrideCom= biner > > MG>ConfigurationNode combine(ConfigurationNode node1=2C ConfigurationNo= de node2) > > MG> http://www.docjar.com/html/api/org/apache/commons/configuration/tre= e/OverrideCombiner.java.html > >> I'm a little bit confused because my idea was to instantiate > >> DefaultConfigurationBuilder for performance reasons only once (as a > >> Singleton) and call getConfiguration subsequently to read "fresh" > >> properties. > >> > >> Thanks > >> Stefan > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe=2C e-mail: user-unsubscribe@commons.apache.org > >> For additional commands=2C e-mail: user-help@commons.apache.org > >> > >=20 >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe=2C e-mail: user-unsubscribe@commons.apache.org > For additional commands=2C e-mail: user-help@commons.apache.org >=20 = --_19211ae4-60dd-4829-a788-11cc517f54e5_--