• 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

Another singleton - should I use it?

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an abstract parent class that contains a static initialiser block, which in turn calls a number of protected methods that load a number of Maps with data from a data source.

I have two sub-classes, one of which will provide the opportunity to update the data source, reload the appropriate Map and return the reloaded Map. I think this class should conform to the singleton design pattern.

Another class however will only ever allow you to read data from another two Maps (there will never be a case to update these maps from the application code). I'm of the opinion that the singleton here is not appropriate as there is no chance of a database update whilst someone reads 'dirty' data from the Maps. Should I just provide static accessor methods on the sub-class to retrieve data from these maps? The traffic into these maps could get quite heavy.

Mant Thanx
As
 
reply
    Bookmark Topic Watch Topic
  • New Topic