Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
William Bernadsson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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,
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
but on the other hand in a clustered environment each node would have it's own such log.?
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic