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 C54471075F for ; Sat, 22 Mar 2014 01:18:19 +0000 (UTC) Received: (qmail 47200 invoked by uid 500); 22 Mar 2014 01:18:13 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 47090 invoked by uid 500); 22 Mar 2014 01:18:13 -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 47081 invoked by uid 99); 22 Mar 2014 01:18:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Mar 2014 01:18:12 +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 (nike.apache.org: domain of mgainty@hotmail.com designates 65.55.116.111 as permitted sender) Received: from [65.55.116.111] (HELO blu0-omc3-s36.blu0.hotmail.com) (65.55.116.111) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Mar 2014 01:18:06 +0000 Received: from BLU172-W37 ([65.55.116.73]) by blu0-omc3-s36.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 21 Mar 2014 18:17:45 -0700 X-TMN: [g5KAU3uc3MZZEAU/JRRu+ieTGdVTwkn2] X-Originating-Email: [mgainty@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="_4b691938-a2e3-4860-888c-f7f11309dd40_" From: Martin Gainty To: Commons Users List Subject: RE: [configuration] Calling getConfiguration on DefaultConfigurationBuilder more than once permitted Date: Fri, 21 Mar 2014 21:17:44 -0400 Importance: Normal In-Reply-To: <532CB2F9.9040109@gmx.net> References: <532CB2F9.9040109@gmx.net> MIME-Version: 1.0 X-OriginalArrivalTime: 22 Mar 2014 01:17:45.0439 (UTC) FILETIME=[87D03EF0:01CF456C] X-Virus-Checked: Checked by ClamAV on apache.org --_4b691938-a2e3-4860-888c-f7f11309dd40_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =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 DefaultConfiguration= Builder more than once permitted >=20 > Hi=2C >=20 > is it permitted to call getConfiguration more than once on the same=20 > instance of DefaultConfigurationBuilder like this: >=20 > DefaultConfigurationBuilder builder =3D new DefaultConfigurationBuilder()= =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 > ... >=20 > The config.xml looks like this: > >=20 > > > > > > > > > > > > >=20 > and the referenced file "test.properties" contains: > a=3Da > b=3Db > c=3Dc >=20 > I asked this question=2C because with the first call of getConfiguration= =20 > the "test.properties"-file is read 10 times (once for every=20 > "config-at")=2C with the second call 20 times=2C with the third call 30=20 > times and so on. So in the end the program slows down and after 100=20 > calls it needs 200ms to read the properties. =20 MG>builder.getConfiguration(true) a Union between one DB Table and another = DB Table MG>if you want to 'merge' 2 groups together I suggest using OverrideCombine= r MG>ConfigurationNode combine(ConfigurationNode node1=2C ConfigurationN= ode node2) MG> http://www.docjar.com/html/api/org/apache/commons/configuration/tree/Ov= errideCombiner.java.html >=20 > I'm a little bit confused because my idea was to instantiate=20 > DefaultConfigurationBuilder for performance reasons only once (as a=20 > Singleton) and call getConfiguration subsequently to read "fresh"=20 > properties. >=20 > Thanks > Stefan >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe=2C e-mail: user-unsubscribe@commons.apache.org > For additional commands=2C e-mail: user-help@commons.apache.org >=20 = --_4b691938-a2e3-4860-888c-f7f11309dd40_--