Hi!  I'm trying to figure out a caching strategy for a fairly simple
tree structure.  The tree will be very heavily used, there are
relatively few nodes, they change only rarely, and transactional
behavior really isn't necessary.  Some sort of cache which updates once
per day would be ideal.

The basic data structure is a CMR entity bean with a one-to-many
relationship with itself.

What is the best way to implement such a cache?

Thought #1) Do relationships get cached along with persistent fields?
Using commit option B seems like a fairly reasonable way to get the
behavior I want - if the relationships are cached as well.  Cache
invalidation is an issue, but I can probably use the Seppuku pattern to
take care of this.  Or maybe setting a time-out will do the trick?

Thought #2) Create a BMP bean which represents the relationship between
a parent and its children (as data objects), and make it read-only with
a time-out.  Of course, it would load itself by grabbing the underlying
entity and calling its getChildren() method.

Thought #3) Cache this outside the EJB system.  This is a perfectly
acceptable alternative, and the one I am leaning towards.  Just have a
Java object with a timer task that refreshes the entire tree once a day,
and put this object in the servlet application scope.  This way I can
have a multithreaded cache and be guaranteed that there is only one
instance of it in memory.  Actually, this is something I wonder about:
For #1 and #2, I would end up with several instances of the same cached
object in memory, right?

Thanks for any advice.

Jeff Schnitzer
[EMAIL PROTECTED]

BTW, as an aside, I am in the midst of switching from Orion to JBoss
because I am finally fed up with errors like this:

C:\java\orion>java -jar orion.jar
Auto-deploying similarity-ejb.jar (New server version detected)...
java.lang.NullPointerException
        at com.evermind._eh._dyc(.:109)
        at com.evermind._fc._izd(.:198)
        at com.evermind._fc._de(.:63)
        at com.evermind._fqb._de(.:30)
        at com.evermind._eq._aa(.:280)
        at com.evermind._ed._aa(.:270)
        at com.evermind._ai._kmd(.:526)
        at com.evermind._aj._kmd(.:287)
        at com.evermind._aj._vxb(.:119)
        at com.evermind.server.ApplicationServer._sxc(.:1308)
        at com.evermind.server.ApplicationServer._ige(.:1265)
        at com.evermind.server.ApplicationServer._vxb(.:1003)
        at com.evermind._cxb.run(.:89)
        at java.lang.Thread.run(Thread.java:536)
        at com.evermind._bt.run(.:47)


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to