Hi,
New to JCS, although I did use Turbines' cache eons ago...
My app allows the user to add their own caches driven from SQL queries
with a single key and an array of String values as the 'value'. After
reading this "The most basic configuration would be a pure memory cache
where every region takes the default values." It made me believe that I
could have a single default defn in cache.ccf and then just add regions
on the fly. This appears to be true see "" below in the log
[INFO 14:04:48.690 GMT] qtp115556431-64:CompositeCacheManager -
Creating cache manager from config file: /cache.ccf
[INFO 14:04:48.698 GMT] qtp115556431-64:ThreadPoolManager -
thread_pool.default PoolConfiguration = useBoundary = [true]
boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4]
keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4]
[INFO 14:04:48.703 GMT] qtp115556431-64:CompositeCacheConfigurator -
Setting default auxiliaries to DC
[INFO 14:04:48.708 GMT] qtp115556431-64:CompositeCacheConfigurator -
setting defaultCompositeCacheAttributes to [ useLateral = true,
useRemote = true, useDisk = true, maxObjs = 30000, maxSpoolPerRun = -1,
diskUsagePattern = 0 ]
[INFO 14:04:48.708 GMT] qtp115556431-64:CompositeCacheConfigurator - No
special ElementAttribute class defined for key
[jcs.default.elementattributes], using default class.
[INFO 14:04:48.712 GMT] qtp115556431-64:CompositeCacheConfigurator -
setting defaultElementAttributes to [ IS_LATERAL = true, IS_SPOOL =
true, IS_REMOTE = true, IS_ETERNAL = true, MaxLifeSeconds = 50, IdleTime
= 50, CreateTime = 1321970688708, LastAccessTime = 1321970688708,
getTimeToLiveSeconds() = 49, createTime = 1321970688708 ]
[INFO 14:04:48.712 GMT] qtp115556431-64:CompositeCacheConfigurator - No
special ElementAttribute class defined for key
[jcs.system.groupIdCache.elementattributes], using default class.
[INFO 14:04:48.728 GMT] qtp115556431-64:LRUMemoryCache - initialized
LRUMemoryCache for groupIdCache
[INFO 14:04:48.729 GMT] qtp115556431-64:CompositeCache - Constructed
cache with name [groupIdCache] and cache attributes [ useLateral = true,
useRemote = true, useDisk = true, maxObjs = 1, maxSpoolPerRun = -1,
diskUsagePattern = 0 ]
[INFO 14:04:48.764 GMT] qtp115556431-64:IndexedDiskCache - Region
[groupIdCache] Cache file root directory: ./jcs
[INFO 14:04:48.768 GMT] qtp115556431-64:IndexedDiskCache - Region
[groupIdCache] Set maxKeySize to: '5000'
[INFO 14:04:48.770 GMT] qtp115556431-64:IndexedDiskCache - Region
[groupIdCache] Indexed Disk Cache is alive.
[INFO 14:04:48.771 GMT] qtp115556431-64:CompositeCacheConfigurator -
Parsed regions []
[INFO 14:04:48.771 GMT] qtp115556431-64:CompositeCacheConfigurator -
Finished configuration in 70 ms.
[INFO 14:04:48.771 GMT] qtp115556431-64:CompositeCacheConfigurator - No
special ElementAttribute class defined for key [jcs.region.Cache for FI
Instrument CUSIP.elementattributes], using default class.
[INFO 14:04:48.771 GMT] qtp115556431-64:LRUMemoryCache - initialized
LRUMemoryCache for Cache for Instrument Agra
[INFO 14:04:48.772 GMT] qtp115556431-64:CompositeCache - Constructed
cache with name [Cache for Instrument Agra] and cache attributes [
useLateral = true, useRemote = true, useDisk = true, maxObjs = 30000,
maxSpoolPerRun = -1, diskUsagePattern = 0 ]
[INFO 14:04:48.772 GMT] qtp115556431-64:IndexedDiskCache - Region
[Cache for FI Instrument CUSIP] Cache file root directory: ./jcs
[INFO 14:04:48.772 GMT] qtp115556431-64:IndexedDiskCache - Region
[Cache for FI Instrument CUSIP] Set maxKeySize to: '5000'
[INFO 14:04:48.772 GMT] qtp115556431-64:IndexedDiskCache - Region
[Cache for FI Instrument CUSIP] Indexed Disk Cache is alive.
But I get this:
java.lang.NullPointerException
at
org.apache.jcs.config.OptionConverter.findAndSubst(OptionConverter.java:292)
at
org.apache.jcs.config.OptionConverter.instantiateByKey(OptionConverter.java:170)
at
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseElementAttributes(CompositeCacheConfigurator.java:441)
at
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:307)
at
org.apache.jcs.engine.control.CompositeCacheConfigurator.parseRegion(CompositeCacheConfigurator.java:283)
at
org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:448)
at
org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:387)
at
org.apache.jcs.engine.control.CompositeCacheManager.getCache(CompositeCacheManager.java:374)
at
com.yambina.edm.edmengine.cacheservice.CacheServiceImpl.testCache(CacheServiceImpl.java:27)
Where CacheServiceImpl:27 looks like this:
@Override
public boolean testCache(String cachename) {
if(ccm.getCache(cachename) != null)
return true;
return false;
}
i.e. CompositeCacheManager.getCache(String name)
And yes the cache is one I created and shows in that log above.
Ideas on what I am missing?
my cache.ccf
# DEFAULT CACHE REGION
# sets the default aux value for any non configured caches
jcs.default=DC
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=30000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.elementattributes.IsEternal=true
jcs.default.elementattributes.MaxLifeSeconds=50
jcs.default.elementattributes.IdleTime=50
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=true
jcs.default.elementattributes.IsLateral=true
# SYSTEM CACHE
# should be defined for the storage of group attribute list
jcs.system.groupIdCache=DC
jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.system.groupIdCache.cacheattributes.MaxObjects=1
jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
# AVAILABLE AUXILIARY CACHES
jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=./jcs
Thx.
David