Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] EDC and asynchronous operations

On 10/26/2010 03:07 PM, John Cortell wrote:
However, the point you bring up is a non-issue in my cache manager implementation. Cleanup is done at the end of a transaction. A transaction's logic is expected to tell the cache manager when it begins and ends so that it can do the necessary tracking and cleanup. Also, it must never store a cache object anywhere. It must always ask the cache manager for anything it needs.

I see, so I suppose with this bookkeeping you can avoid using weak references.  I'm curious to see how this works out in the bigger picture.


protected <sometype> process() throws InvalidCacheException, CoreException {
    boolean invalidCache = false;
    CacheManager cacheMgr = EDCLaunch.getCacheManager(dsfSession.getId());
    try {
        // ... logic  that uses cache objects obtained from cacheMgr
        return result;
    catch (InvalidCacheException exc) {
        invalidCache = true;
        throw exc;
    finally {

Also, using weak references could leave the cache being purged too aggressively.  A combination of soft references and weak references would solve the problem.

.... I'm looking forward to see what you come up with :-)

I'm thinking that, too. And combining weak references with soft references just sounds a bit messy and over-engineered. I think "simple" will work here. My manager works using a configurable ceiling. When the number of cache objects exceeds that limit by 20%, it goes through and purges as many of the least recently referenced (obtained) objects as possible to get back to the max count. It makes sure to not purge any cache objects that have been part of an InvalidCacheException-failed transaction.

_______________________________________________ cdt-dev mailing list cdt-dev@xxxxxxxxxxx

Back to the top