• 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

sharing MAP on MDB pool

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


reply
    Bookmark Topic Watch Topic
  • New Topic