openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drewz <>
Subject DataCacheStoreManager locking
Date Thu, 08 Oct 2009 18:48:37 GMT

Hi guys,

I'm trying to understand the rationale for some of the locking occurring in
DataCacheStoreManager. Under certain circumstances of high load, we have a
lot of waiting threads on cache.writeLock(). This may be normal, but I want
to understand the blocks of code that look similar to:

        // make sure that we're not trying to cache an old version
        try {
            data = cache.get(sm.getObjectId());
            if (data != null && compareVersion(sm, sm.getVersion(),
                data.getVersion()) == VERSION_EARLIER)
                return true;

            // cache newly loaded info. It is safe to cache data frorm
            // initialize() because this method is only called upon
            // initial load of the data.
            if (data == null)
                data = newPCData(sm);
        } finally {

What part of the underlying DataCache requires locking, and why isn't this
lock done closer to the cache.put? I see the CacheMap has it's own writeLock
mechanism, which I thought would make the writeLock cals on
ConcurrentDataCache redundant? Please correct me if that is not the case.


View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message