• 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

Where to keep system-wide (global) data in JEE application

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy,

I work on JEE project that communicates to multiple external systems. I have to implement connection log, i.e. up/down for each external subsystem. If outgoing request is successful then connection state is switched to UP, if not then it is DOWN. The log should not contain same repeating entries for the connection. That is only when state is switched, entry has to be written to log file. This is why we have to store current connection state somewhere. We update connection state in Hashtable everytime request goes out. What is the best place to put this hashtable. Initially I made singleton. But now we are thinking to move it to stateless session bean and save this data in context.

Thanks,
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
William,
Why not store the connection state in the database? That's the true shared point for all clones/clusters of your application.
 
William Bernadsson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but on the other hand in a clustered environment each node would have it's own such log.?
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
William,
It depends on how many read/ write operations you want to perform, if you are going to have many read/ write operations on that state values then a cache system like EhCache would be very suitable for a single instance or a clustered environment. You can use ehCache event handlers to store the changes in a database system or a log file when an state value changes. By using event system you will not involve your system with database for many read/ write operations. On the other hand If you have a few read and write operations then Database would do the trick.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic