| Author |
Where to keep system-wide (global) data in JEE application
|
William Bernadsson
Greenhorn
Joined: Jul 14, 2008
Posts: 10
|
|
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
internet detective
Marshal
Joined: May 26, 2003
Posts: 26216
|
|
William,
Why not store the connection state in the database? That's the true shared point for all clones/clusters of your application.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
William Bernadsson
Greenhorn
Joined: Jul 14, 2008
Posts: 10
|
|
|
but on the other hand in a clustered environment each node would have it's own such log.?
|
 |
Masoud Kalali
Author
Ranch Hand
Joined: Jul 08, 2004
Posts: 531
|
|
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.
|
Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
|
 |
 |
|
|
subject: Where to keep system-wide (global) data in JEE application
|
|
|