• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Change the value at runtime

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have created a caching system. It is currently reading the thread pool size from the properties file. It need to be changed in such a way so the value can be chnaged at runtime without re-starting the server. Please throw some ideas how it can be done?
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you talking about maintaining an application configuration? If that is so, I would do it this way..

Have a class that provides methods to read application configuration properties, like config.getproperty(propertyName). All the classes that need to read some property will call this method.

The class constructor is private and read the properties file here. Class will have a private variable that holds its own instance.

Other objects of the application obtain an instance of this class by calling a static method Configuration.getInstance(). This method returns the local variable that we talked about above.

write a method to reload configuration that makes the local instance variable null and re creates it . Call this method when ever a change is made to your properties file.

Hope it helps.

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To put the things in a simple way. I think Rajasekar is advising you to create a singleton class.
reply
    Bookmark Topic Watch Topic
  • New Topic