cc.setName(key);
return cc;
}
public static CacheManager getCacheManager(Bus bus, URL configFileURL) {
CacheManager cacheManager = null;
String globalCacheManagerName = getGlobalCacheManagerName(bus);
if (globalCacheManagerName != null) {
cacheManager = CacheManager.getCacheManager(globalCacheManagerName);
}
// notice for a global cache manager, we skip the count stuff which
// means the release cache manager method below is a no op, as the
// COUNT will not have been initialised.
if (cacheManager == null) {
if (configFileURL == null) {
//using the default
cacheManager = findDefaultCacheManager(bus);
}
if (cacheManager == null) {
if (configFileURL == null) {
cacheManager = createCacheManager();
} else {
cacheManager = createCacheManager(configFileURL);
}
}
AtomicInteger a = COUNTS.get(cacheManager.getName());
if (a == null) {
COUNTS.putIfAbsent(cacheManager.getName(), new AtomicInteger());
a = COUNTS.get(cacheManager.getName());
}
if (a.incrementAndGet() == 1) {
//System.out.println("Create!! " + cacheManager.getName());
}
}