Hi to all, I'm working on my first project using EJB 3.0 and I'm facing some difficulties. Long story short, I basically want to share an object across several (stateless and mdb) bean instances; the object is costly to build and for this reason I would like to just build it once and keep a single instance in memory (probably in the JNDI). The object is kind of like a tree, where read and updates can be performed.
What I would like is some sort of mechanism similar to READ_COMMITED for databases (reads at any time as long as there are no writes going on) to manage the concurrency access to the object. I understand EJB's specs state that developers should not manage the synchronization of objects, especially resources. So, what's my best option in order to solve my problem? I'm using JBoss 4.2.2, so I'm taking a look at JBoss Cache, but I'm definitely open to any other suggestion.