• Post Reply Bookmark Topic Watch Topic
  • New Topic

sharing MAP on MDB pool  RSS feed

 
domenico febbo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I need to share a ConcurrentHashMap Map (from the Collection Framework) between a pool of MDBs.
What is the best practice?
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your application is in a cluster or will move to a cluster, think of db or serialized objects (or any persistent store).
If it's readonly and not in a cluster, you can use a static variable.

ram.
 
domenico febbo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ramprasad madathil wrote:If your application is in a cluster or will move to a cluster, think of db or serialized objects (or any persistent store).
If it's readonly and not in a cluster, you can use a static variable.

ram.


Thanks,
It will be in cluster and not read-only, but I don't want to use DB or persistent because of some other constraint, so
1) how can I use serialized object?
2) there is a chance to use a Session EJB accessible vie JNDI lookup?

 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can I use serialized object?


I dont think it's a great idea. Basically you create an object on first access and write it to a shared file system storage. Every time, you retrieve it, change the values and write it back. You will have to write custom code to ensure locking etc (to prevent concurrency) which is the same challenge you would face if you use static in a non-clustered environment.

there is a chance to use a Session EJB accessible vie JNDI lookup?


And store the data in the session ejb - a stateful session ejb? I really dont know - you will have to find answer to the same challenges of multithreading etc.

Google for cluster aware cache (or ditributed cache) - there is one here - http://www.opensymphony.com/oscache/wiki/Clustering.html

ram.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!