File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Another singleton - should I use it?

 
Alana Sparx
Ranch Hand
Posts: 121
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic