incubator-directmemory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Lamy <ol...@apache.org>
Subject chicken and eggs issue in Cache class (configuration mechanism)
Date Tue, 21 Feb 2012 17:59:14 GMT
Currently Solr test failed due to a chicken and eggs issue.

    private static CacheService cacheService = new CacheServiceImpl(
getMemoryManager() );


    public static void init( int numberOfBuffers, int size, int
initialCapacity, int concurrencyLevel )
    {
        cacheService.init( numberOfBuffers, size, initialCapacity,
concurrencyLevel );
    }

    public static MemoryManagerService getMemoryManager()
    {
        return cacheService.getMemoryManager();
    }

This Cache class is a bit confuse IMHO.
What is the purpose of this class exactly ? it looks to duplicate
CacheServiceImpl.

I wonder about having like CacheFactory (or an other name) with a
DirectMemoryConfiguration class. I would prefer change the current
Cache class with that.

class DirectMemoryConfiguration {
  List<CacheRegion> cacheRegions;
}

class CacheRegion {
  String name;
  int numberOfBuffers;
  int size;
  int initialCapacity;
  int concurrencyLevel,
  String memoryManagerClazz; // optionnal
}

Basically this will instantiate a CacheServiceImpl per cacheRegion.

BTW after we can talk about a configuration file mechanism.

WDYT ?

Lemme if that makes sense for you.

-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

Mime
View raw message