commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Kee <k...@ARCCorp.com>
Subject RE: [Configuration] Caching properties
Date Tue, 06 Apr 2004 17:02:00 GMT
That is actually what we are doing here. However, the drawback is that since
the properties are cached, changes to the configuration file with not be
read in with new values. You can use the namespaces to read a subset of the
configurations to reduce the runtime cost, however, apparently the
configuration is not capable of reading nested namespace.

Thanks,
Keith 

> -----Original Message-----
> From: Jörg Schaible [mailto:Joerg.Schaible@Elsag-Solutions.com] 
> Sent: Tuesday, April 06, 2004 12:39 PM
> To: Jakarta Commons Users List
> Subject: RE: [Configuration] Caching properties
> 
> 
> Michael MATTOX wrote on Tuesday, April 06, 2004 6:17 PM:
> 
> > From what I've seen of the documentation and javadocs, using 
> > Configuration requires creating  new object which will then read in 
> > the properties file. If I have 20 classes, all using the 
> same property 
> > file, I'd like to avoid having 20 Configuration objects 
> that parse the 
> > config file 20 times.
> 
> Yes.
> 
> > Is there anything wrong with creating a singleton which has a
> > getConfiguration() method to return a global Configuration class?
> 
> No. But if you write you have to synchronize yourself.
> 
> > I know I could go one step further and have the
> > Singleton implement the Configuration interface but that 
> seems to be a 
> > lot of unnecessary work.
> > 
> > An alternative would be like in log4J where they have a static 
> > getLogger() method in the Logger class.  But in looking at 
> the source, 
> > log4J actually creates a new logger each time instead of caching it.
> > 
> > Any suggestions?
> 
> The current implementation of SubsetConfiguration is just a 
> delegator. So you can tailor a big configuration in smart 
> pieces without a lot of run-time costs. So you can have a 
> singleton for the global configuration and can use subsets 
> (like a logger) for the relevant parts in your classes.
> 
> Regards,
> Jörg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 

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


Mime
View raw message