// if we only have a single cache loader configured in the chaining cacheloader then
// don't use a chaining cache loader at all.
// also if we are using passivation then just directly use the first cache loader.
if (clmConfig.useChainingCacheLoader()) {
// create chaining cache loader.
ChainingCacheStore ccl = new ChainingCacheStore();
tmpLoader = ccl;
// only one cache loader may have fetchPersistentState to true.
int numLoadersWithFetchPersistentState = 0;
for (CacheLoaderConfig cfg : clmConfig.getCacheLoaderConfigs()) {
if (cfg instanceof CacheStoreConfig) {
if (((CacheStoreConfig) cfg).isFetchPersistentState()) numLoadersWithFetchPersistentState++;
if (numLoadersWithFetchPersistentState > 1)
throw new Exception("Invalid cache loader configuration!! Only ONE cache loader may have fetchPersistentState set to true. Cache will not start!");
assertNotSingletonAndShared(((CacheStoreConfig) cfg));
}
CacheLoader l = createCacheLoader(cfg, cache);
ccl.addCacheLoader(l, cfg);
}
} else {
CacheLoaderConfig cfg = clmConfig.getFirstCacheLoaderConfig();
tmpLoader = createCacheLoader(cfg, cache);
if (cfg instanceof CacheStoreConfig)