net.sf.ehcache.Ehcache.getCacheManager()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(236)

本文整理了Java中net.sf.ehcache.Ehcache.getCacheManager()方法的一些代码示例,展示了Ehcache.getCacheManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ehcache.getCacheManager()方法的具体详情如下:
包路径:net.sf.ehcache.Ehcache
类名称:Ehcache
方法名:getCacheManager

Ehcache.getCacheManager介绍

[英]Gets the CacheManager managing this cache. For a newly created cache this will be null until it has been added to a CacheManager.
[中]获取管理此缓存的CacheManager。对于新创建的缓存,在将其添加到CacheManager之前,该值将为null。

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Override
  public void release() {
    try {
      getCache().getCacheManager().removeCache( getCache().getName() );
    }
    catch (IllegalStateException e) {
      //When Spring and Hibernate are both involved this will happen in normal shutdown operation.
      //Do not throw an exception, simply log this one.
      LOG.debug( "This can happen if multiple frameworks both try to shutdown ehcache", e );
    }
    catch (net.sf.ehcache.CacheException e) {
      if ( e instanceof NonStopCacheException ) {
        HibernateNonstopCacheExceptionHandler.getInstance()
            .handleNonstopCacheException( (NonStopCacheException) e );
      }
      else {
        throw new CacheException( e );
      }
    }
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 */
public CacheManager getCacheManager() {
  return underlyingCache.getCacheManager();
}

代码示例来源:origin: net.sf.ehcache/ehcache

public QueryManagerImpl(Collection<Ehcache> ehcaches) {
  CacheManager cm;
  for (Ehcache ehcache : ehcaches) {
    cm = ehcache.getCacheManager();
    if (cacheManagerEhcacheMap.containsKey(cm)) {
      cacheManagerEhcacheMap.get(cm).add(ehcache);
    } else {
      List<Ehcache> ehcacheList = new ArrayList<Ehcache>();
      ehcacheList.add(ehcache);
      cacheManagerEhcacheMap.put(cm, ehcacheList);
    }
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

private CacheEventListener createCacheEventReplicator(Ehcache cache) {
  // the race is not a problem here, since the event replicator will only be created once in the clustered instance factory
  // this replicator map is simply a locally cached version, several puts for the same cache will result in the same value being put
  CacheEventListener replicator = replicators.get(cache);
  if (null == replicator) {
    replicator = cache.getCacheManager().createTerracottaEventReplicator(cache);
    replicators.put(cache, replicator);
  }
  return replicator;
}

代码示例来源:origin: net.sf.ehcache/ehcache

private static String getCacheManagerName(Ehcache cache) {
 final String cacheMgrName;
 if (cache.getCacheManager().isNamed()) {
  cacheMgrName = cache.getCacheManager().getName();
 } else {
  cacheMgrName = TerracottaClusteredInstanceFactory.DEFAULT_CACHE_MANAGER_NAME;
 }
 return cacheMgrName;
}

代码示例来源:origin: net.sf.ehcache/ehcache

private JobDetail makeOverseerJob() throws SchedulerException {
 JobDataMap jdm = new JobDataMap();
 jdm.put(PROP_CACHE_MGR_NAME, underlyingCache.getCacheManager().getName());
 jdm.put(PROP_CACHE_NAME, underlyingCache.getName());
 jdm.put(PROP_CONFIG_OBJECT, config);
 JobDetail seed = JobBuilder.newJob(OverseerJob.class).storeDurably()
   .withIdentity(OVERSEER_JOB_NAME, groupName)
   .usingJobData(jdm).build();
 return seed;
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Package protected List of cache peers
 *
 * @param cache
 * @return a list of {@link CachePeer} peers for the given cache, excluding the local peer.
 */
static List<CachePeer> listRemoteCachePeers(Ehcache cache) {
  CacheManagerPeerProvider provider = cache.getCacheManager().getCacheManagerPeerProvider("RMI");
  return provider.listRemoteCachePeers(cache);
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
   * Divine the name.
   * 
   * @param cache the cache
   * @return the string
   */
  public static String divineName(Ehcache cache) {
    return cache.getCacheManager().getName() + "." + cache.getName();
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 */
@Override
public boolean isLocalHeapCountBased() {
 return cache.getCacheConfiguration()
       .getMaxBytesLocalHeap() <= 0 && !(cache.getCacheManager() != null && cache.getCacheManager()
   .getConfiguration()
   .isMaxBytesLocalHeapSet());
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Package protected List of cache peers
 *
 * @param cache
 */
protected List listRemoteCachePeers(Ehcache cache) {
  CacheManagerPeerProvider provider = cache.getCacheManager().getCacheManagerPeerProvider("RMI");
  if (provider == null) {
    return null;
  } else {
    return provider.listRemoteCachePeers(cache);
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

void setUpWanConfig() {
 if (!cache.getCacheManager().getConfiguration().getTerracottaConfiguration().isWanEnabledTSA()) {
  toolkitInstanceFactory.markCacheWanDisabled(cache.getCacheManager().getName(), cache.getName());
 }
}

代码示例来源:origin: apache/cloudstack

public void setCache(Ehcache cache) {
  BlockingCache ref;
  if (!(cache instanceof BlockingCache)) {
    ref = new BlockingCache(cache);
    cache.getCacheManager().replaceCacheWithDecoratedCache(cache, new BlockingCache(cache));
  } else {
    ref = (BlockingCache)cache;
  }
  this.cache = ref;
}

代码示例来源:origin: net.sf.ehcache/ehcache

@Override
public ToolkitNotifier<CacheEventNotificationMsg> getOrCreateCacheEventNotifier(Ehcache cache) {
 return getOrCreateCacheEventNotifier(cache.getCacheManager().getName(), cache.getName());
}

代码示例来源:origin: net.sf.ehcache/ehcache

@Override
public synchronized AsyncCoordinator getOrCreateAsyncCoordinator(final Ehcache cache, final AsyncConfig config) {
 return getOrCreateAsyncCoordinator(cache.getCacheManager().getName(), cache.getName(), config);
}

代码示例来源:origin: net.sf.ehcache/ehcache

@Override
public ToolkitNotifier<CacheConfigChangeNotificationMsg> getOrCreateConfigChangeNotifier(Ehcache cache) {
 return getOrCreateConfigChangeNotifier(cache.getCacheManager().getName(), cache.getName());
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 */
public boolean setTransactionTimeout(int timeout) throws XAException {
  if (timeout < 0) {
    throw new EhcacheXAException("timeout must be >= 0, was: " + timeout, XAException.XAER_INVAL);
  }
  if (timeout == 0) {
    this.transactionTimeout = cache.getCacheManager().getTransactionController().getDefaultTransactionTimeout();
  } else {
    this.transactionTimeout = timeout;
  }
  return true;
}

代码示例来源:origin: net.sf.ehcache/ehcache

@Override
public ToolkitNotifier<CacheDisposalNotification> getOrCreateCacheDisposalNotifier(Ehcache cache) {
 return toolkit.getNotifier(EhcacheEntitiesNaming.getToolkitCacheNameFor(cache.getCacheManager().getName(), cache.getName())
               + DELIMITER + DISPOSAL_NOTIFIER_SUFFIX, CacheDisposalNotification.class);
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Constructs using a backing CacheConfiguration
 *
 * @param cache
 */
public CacheConfiguration(net.sf.ehcache.Ehcache cache) {
  cacheConfiguration = cache.getCacheConfiguration();
  objectName = createObjectName(cache.getCacheManager().toString(), cache.getName());
}

代码示例来源:origin: net.sf.ehcache/ehcache

private Store(Ehcache ehcache, Object storeBean) throws NotCompliantMBeanException {
  this.objectName = createObjectName(ehcache.getCacheManager().getName(), ehcache.getName());
  if (storeBean instanceof DynamicMBean) {
    this.storeBean = (DynamicMBean) storeBean;
  } else {
    this.storeBean = new StandardMBean(storeBean, null);
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Constructs an object from an ehcache statistics object
 *
 * @param ehcache the backing ehcache
 */
public CacheStatistics(Ehcache ehcache) {
  this.ehcache = ehcache;
  this.statistics = ehcache.getStatistics();
  objectName = createObjectName(ehcache.getCacheManager().getName(),
      ehcache.getName());
}

相关文章

Ehcache类方法