Hi Alex,

Alex Bates wrote:
Has anyone implemented a read/write cache for use with OJB?

This article goes over how to implement, and links to some code for
ReadWriteLock (and ConcurrentHashMap):
http://www.theserverside.com/resources/article.jsp?l=Readers-Writers

In our ODMG implementation we have a peesimistic locking mechanism based on a MROW (many readers one writer) scheme. It's sitting on top of the cache. See http://db.apache.org/ojb/lockmanager.html for details.



However, my real question is: would it be possible to implement such a cache for use with the J2EE version of OJB? Since you can't use threads or the threading API, it appears it would not. If that's the case, I supposed the read/write cache would only be able to run in the servlet layer?

One of the *really* cool OJB features is that the ODMG lockmanager is able to synchronize any number of clients possibly running in different JVMs, and/or across different physical machines!


To make this possible we are using persistent locks that are stored in the database.
If you want to use this feature you just have to set the following OJB.properties switch:


# The LockMapClass entry tells OJB which concrete LockMap
# implementation is to be used.
# If OJB is running on multiple concurrent clients it is recommended
# to use the PersistentLockMapImpl. It guarantees to provide
# Lockamanagement across multiple JVMs.
# If OJB is running in a single JVM (e.g. in a desktop app, or in a
# servlet engine) it is save to use the InMemoryLockMapImpl.
# Using it will result in a large performance gain.
LockMapClass=org.apache.ojb.odmg.locking.PersistentLockMapImpl
#LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl

cheers,
Thomas


Alex



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to