本文整理匯總了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();
}
}
}