本文整理汇总了Java中net.sf.ehcache.CacheManager.getCacheManager方法的典型用法代码示例。如果您正苦于以下问题:Java CacheManager.getCacheManager方法的具体用法?Java CacheManager.getCacheManager怎么用?Java CacheManager.getCacheManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.ehcache.CacheManager
的用法示例。
在下文中一共展示了CacheManager.getCacheManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerCacheMBean
import net.sf.ehcache.CacheManager; //导入方法依赖的package包/类
private void registerCacheMBean() {
CacheManager manager = CacheManager.getCacheManager(CacheManager.DEFAULT_NAME);
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ManagementService.registerMBeans(manager, mBeanServer, false, false, true, true);
}
示例2: getCacheManager
import net.sf.ehcache.CacheManager; //导入方法依赖的package包/类
private static CacheManager getCacheManager()
{
return CacheManager.getCacheManager(CACHE_MANAGER_NAME);
}
示例3: afterPropertiesSet
import net.sf.ehcache.CacheManager; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() throws IOException, CacheException {
logger.info("Initializing EhCache CacheManager");
InputStream is = (this.configLocation != null ? this.configLocation.getInputStream() : null);
try {
Configuration configuration = (is != null ?
ConfigurationFactory.parseConfiguration(is) : ConfigurationFactory.parseConfiguration());
if (this.cacheManagerName != null) {
configuration.setName(this.cacheManagerName);
}
if (this.shared) {
// Old-school EhCache singleton sharing...
// No way to find out whether we actually created a new CacheManager
// or just received an existing singleton reference.
this.cacheManager = CacheManager.create(configuration);
}
else if (this.acceptExisting) {
// EhCache 2.5+: Reusing an existing CacheManager of the same name.
// Basically the same code as in CacheManager.getInstance(String),
// just storing whether we're dealing with an existing instance.
synchronized (CacheManager.class) {
this.cacheManager = CacheManager.getCacheManager(this.cacheManagerName);
if (this.cacheManager == null) {
this.cacheManager = new CacheManager(configuration);
}
else {
this.locallyManaged = false;
}
}
}
else {
// Throwing an exception if a CacheManager of the same name exists already...
this.cacheManager = new CacheManager(configuration);
}
}
finally {
if (is != null) {
is.close();
}
}
}