• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

EJB Cache  RSS feed

 
Author
Ranch Hand
Posts: 144
5
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a project with EAServer and Sybase DB. We are cacheing some ids in our EJB like this. We have static member variables:

private static String buArcPerTraitID = null;

And methods like this

This is our Cacheing mechanism. To avoid running SQL constantly. This data is fairly constant. Only changes from differing environments. This is in a stateless session bean. This seems like poor design. I have look through this forum and seen mention of using a singleton class as a possible solution. I am going play around with that. Is there any other suggestions anyone would like to offer. I am open to anything.
Thanks,
Tom
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Singleton a good way to achieve caching. The only view i would like to add is, load this singleton class at the time of server startup. And design a way to refresh this cache at runtime if required.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!