commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <christian.migow...@lhsystems.com>
Subject commons-configuration reload() how to do it?
Date Wed, 23 Jan 2008 11:18:48 GMT
Hello,

how is it possible to reload a configuration file without using a
ReloadingStrategy (or, to be more precise: FileChangedReloadingStrategy
or ManagedReloadingStrategy)?

I found out the time consuming way that calling
XMLConfiguration.reload() does nothing because it seems like that as
default ReloadingStrategy the InvariantReloadingStrategy is used, which
prevents reloading.

So how can i reload if i don't want to do it automatically and don't
want to trigger it via JMX?

thanks in advance and regards,
christian Migowski!



P.S. reproducing this issue is easy:
//first create a xml file (yourfile.xml):

<?xml version="1.0" encoding="UTF-8"?>
<x><mycontent>hi there</mycontent></x>


code:
XMLConfiguration config = new XMLConfiguration("yourfile.xml");
System.out.println("mycontent: "+config.getString("mycontent"));
//now change your file
Thread.sleep(10000);
config.reload();
//and see, the changed file content isn't reloaded
System.out.println("mycontent: "+config.getString("mycontent"));
 


Sitz der Gesellschaft / Corporate Headquarters:
Lufthansa Systems Infratec GmbH, Kelsterbach
Registereintragung / Registration:
Amtsgericht Darmstadt 83851


Vorsitzender des Aufsichtsrats /
Chairman of the Supervisory Board:
Dr. Gunter Kuechler


Geschaeftsfuehrung / Management:
Dr. Hannes Pfister

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message