From user-return-26651-apmail-commons-user-archive=commons.apache.org@commons.apache.org Wed Sep 7 17:03:47 2011 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 7880D8B34 for ; Wed, 7 Sep 2011 17:03:47 +0000 (UTC) Received: (qmail 16260 invoked by uid 500); 7 Sep 2011 17:03:46 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 16064 invoked by uid 500); 7 Sep 2011 17:03:45 -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 16056 invoked by uid 99); 7 Sep 2011 17:03:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Sep 2011 17:03:44 +0000 X-ASF-Spam-Status: No, hits=3.3 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [98.139.213.151] (HELO nm7-vm0.bullet.mail.bf1.yahoo.com) (98.139.213.151) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 07 Sep 2011 17:03:36 +0000 Received: from [98.139.215.140] by nm7.bullet.mail.bf1.yahoo.com with NNFMP; 07 Sep 2011 17:03:15 -0000 Received: from [98.139.212.194] by tm11.bullet.mail.bf1.yahoo.com with NNFMP; 07 Sep 2011 17:03:15 -0000 Received: from [127.0.0.1] by omp1003.mail.bf1.yahoo.com with NNFMP; 07 Sep 2011 17:03:15 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 364596.29723.bm@omp1003.mail.bf1.yahoo.com Received: (qmail 93608 invoked by uid 60001); 7 Sep 2011 17:03:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1315414994; bh=FYxNU9AmwvJ3KXz7zSvhnbeEhdsnE7BkOhv6j7TklX8=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=q/wmCjd1Ch5G0MftnSh0DNH7NUiRV+nwrhy1TIPaN7V1EXdl2SnOsw593MXhYYmtv6h5SCsJPjH7BRiG6/6U8KB58cN7KkFkLrSWinImHsAEG8TIv8E02vr3jmCQIHIUkUPfSaHVknR7wxR9e8PR0Ux7oNmjcl4/YmQPPCXk2oY= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=pJ9q9pgodeZXjWidzmtfVNuo2KqEAxQWER+u0fF51/gshTf4cDPbKGV8mek/DzY/2DaV+jsbSJg99Iboa3nitNB6J2b7bXJ1j10uxbzudAMM+kAEZM+RKD4uapUM8HDVW80oFRyRBi018mQfglPUC5ZMwfNu+EuYWcebzQ0qpcg=; X-YMail-OSG: omNYQ_4VM1nt5rg5YUFwlQo_Q1Z15oO7PE.nof4z.efFk24 ok8pVDa_eKogEDtgmGyy.5O9EPGP0JeNxO8E9LMlM7Q7g7PlXn8G4wTazzuQ TAnYDDOfmEIfo1EMDTL_RHFaz0zwtps3ih57MQQQQ6pg3_CdZVWpnQpH_Ski N3_CpGV423V6WRvQ.gQE3k5gwpRSvmcfqo7BxQEgFRbf08NrQtFY_Ts3cTGr Uk9czOAAC3mk9Lvd3b5NSSixOaVh1.TNhVVLyebP8IMilduAAvyCP1WylCFs r.w.PvajBBBbuw_ZuzRtiBhU8c2v.TRAVo8fb.Q2rouB_k_ZIN0dm2GPoNiN OTcWdT4lWtoVzs0nhlRtCWuDbTlVs9DJV8iVKI9gABnklGuMgN2wlF6v6q5T wnzg- Received: from [208.79.228.125] by web36907.mail.mud.yahoo.com via HTTP; Wed, 07 Sep 2011 10:03:14 PDT X-Mailer: YahooMailWebService/0.8.113.315625 References: <1315028886.931.YahooMailNeo@web36903.mail.mud.yahoo.com> <1315029561.96493.YahooMailNeo@web36905.mail.mud.yahoo.com> <4E62505E.9070203@oliver-heger.de> Message-ID: <1315414994.73456.YahooMailNeo@web36907.mail.mud.yahoo.com> Date: Wed, 7 Sep 2011 10:03:14 -0700 (PDT) From: Srinivas Jonnalagadda Reply-To: Srinivas Jonnalagadda Subject: Re: configuration --- get the properties object loaded after the delayed refresh To: Commons Users List In-Reply-To: <4E62505E.9070203@oliver-heger.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-725332117-1315414994=:73456" --0-725332117-1315414994=:73456 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Oliver,=0A=A0=0AThanks for the reply. I wrote a JUNIT test and Below is the= code. My aim was that when i set the refresh delay to 500 and after the in= itial test passed i put a thread.sleep for 2 minutes. when=A0 the thread sl= eeps i am changing the value of the=A0=A0JEDI_ENVIRONMENT to some thing els= e. When the thread wakes up I wanted to see the props refreshed with new va= lues so that the tes tcase fails which means the program runs as expected. = Pls help me.=0A=A0=0A=A0=0Asincerely,=0ASrinivas Jonnalagadda=0A=A0@TestPro= pertiesConfiguration config =3D =0AProperties props =3D =0Aconfig.setFileNa= me(=0Aconfig.load(); =0AFileChangedReloadingStrategy strategy =3D =0Astrate= gy.setRefreshDelay(500); =0Aconfig.setReloadingStrategy(strategy); =0Aasser= tEquals(config.getString(=0Aprops =3D ConfigurationConverter.getProperties(= config);=0AassertEquals(props.getProperty(=0AThread.sleep(200000); =0Aasser= tEquals(config.getString(=0ASystem.=0AassertEquals(props.getProperty(=0A}= =0A=A0=0A=A0publicvoidtestGetBuiltPropertyFileName() throwsException {newPr= opertiesConfiguration(); null;TEST_FILE); newFileChangedReloadingStrategy()= ; "JEDI_ENVIRONMENT"),"TEST");"JEDI_ENVIRONMENT"),"TEST");"JEDI_ENVIRONMENT= "),"TEST");out.println("Test");"JEDI_ENVIRONMENT"),"TEST");=0A=0AFrom: Oliv= er Heger =0ATo: Commons Users List =0ASent: Saturday, September 3, 2011 11:05 AM=0ASubject: Re:= configuration --- get the properties object loaded after the delayed refre= sh=0A=0AHi,=0A=0AAm 03.09.2011 07:59, schrieb Srinivas Jonnalagadda:=0A> Hi= ,=0A>=0A> Below is the code for i wrote and seems at the propsConfig object= gets refreshd after the delay but the result object has the old values sti= ll. How do i get the new values into the result object after the refresh. I= am trying to create a Configuration listener as well and that alos seems n= ot to work.=A0 The main objective for me is to get the properties object lo= aded with new values without JBOSS server restart. Any help is appreciated.= =0A>=0A>=0A> Regards,=0A> Srinivas J=0A=0Ayour code looks good, therefore I= am not sure whether I fully understand =0Ayour problem.=0A=0AHow can you t= ell that the properties configuration object is refreshed =0Acorrectly when= the result object still has the old values? Do you get =0Aother results if= you access the configuration object directly, e.g. by =0Acalling propsConf= ig.getString("someKey") ? (If so, this would indicate a =0Abug in the Confi= gurationConverter.getProperties() implementation.)=0A=0AOliver=0A=0A>=0A> P= roperties result =3D null;=0A> Configuration config =3D null;=0A> URL resou= rceURL =3D null;=0A> FileChangedReloadingStrategy refreshStrategy =3D new F= ileChangedReloadingStrategy();=0A> refreshStrategy.setRefreshDelay(refreshD= elay);=0A>=0A> PropertiesConfiguration propsConfig =3D new PropertiesConfig= uration();=0A> propsConfig.setFileName(name);=0A> propsConfig.load();=0A> p= ropsConfig.setReloadingStrategy(refreshStrategy);=0A> result =3D Configurat= ionConverter.getProperties(propsConfig);=0A=0A=0A--------------------------= -------------------------------------------=0ATo unsubscribe, e-mail: user-= unsubscribe@commons.apache.org=0AFor additional commands, e-mail: user-help= @commons.apache.org --0-725332117-1315414994=:73456--