4 Replies Latest reply on Mar 14, 2008 11:00 AM by Alejandro Dominguez

    Sharing object with READ_COMMITED?

    Alejandro Dominguez Newbie

      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 (as in minutes might be required) to build and for this reason I would like to just build it once and keep a single instance in memory. The object is kind of like a tree, where read and updates can be performed. I could end up having several of this costly objects laying around (with different internal data).

      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.
      I'm using JBoss 4.2.2, so I'm taking a look at JBoss Cache 1.4.x, but I can't quite figure out the right approach to the problem.

      Could somebody please show me a high overview of how JBoss Cache could be used in this context?

      Best regards