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

x33g5p2x  于2022-01-18 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(157)

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

Cache.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: net.sf.ehcache/ehcache

private CacheCluster getCacheCluster() {
  CacheCluster cacheCluster;
  try {
    cacheCluster = getCacheManager().getCluster(ClusterScheme.TERRACOTTA);
  } catch (ClusterSchemeNotAvailableException e) {
    LOG.info("Terracotta ClusterScheme is not available, using ClusterScheme.NONE");
    cacheCluster = getCacheManager().getCluster(ClusterScheme.NONE);
  }
  return cacheCluster;
}

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

/**
 * For use by CacheManager.
 *
 * @param cacheManager the CacheManager for this cache to use.
 */
public void setCacheManager(CacheManager cacheManager) {
  CacheManager oldValue = getCacheManager();
  this.cacheManager = cacheManager;
  firePropertyChange("CacheManager", oldValue, cacheManager);
}

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

@Override
public void clusterRejoined(ClusterNode oldNode, ClusterNode newNode) {
  if (newNode.equals(this.cache.getCacheManager().getCluster(ClusterScheme.TERRACOTTA).getCurrentNode())) {
    mostRecentRejoinTimeStamp = System.currentTimeMillis();
    clusterObserver.end(ClusterEventOutcomes.REJOINED);
  }
}

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

@Override
public void clusterOnline(ClusterNode node) {
  if (node.equals(this.cache.getCacheManager().getCluster(ClusterScheme.TERRACOTTA).getCurrentNode())) {
    clusterObserver.end(ClusterEventOutcomes.ONLINE);
  }
}

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

@Override
public void clusterOffline(ClusterNode node) {
  if (node.equals(this.cache.getCacheManager().getCluster(ClusterScheme.TERRACOTTA).getCurrentNode())) {
    clusterObserver.end(ClusterEventOutcomes.OFFLINE);
  }
}

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

private boolean skipUpdateAccessStatistics(Element element) {
 if (configuration.isFrozen()) {
  boolean forLifetime = element.isEternal();
  boolean forHeap =  configuration.getMaxEntriesLocalHeap() > 0 || configuration.getMaxBytesLocalHeap() > 0
      || getCacheManager().getConfiguration().isMaxBytesLocalHeapSet();
  boolean forDisk = configuration.isOverflowToDisk() && (configuration.getMaxEntriesLocalDisk() > 0 || configuration.getMaxBytesLocalDisk() > 0
      || getCacheManager().getConfiguration().isMaxBytesLocalDiskSet());
  return !(forLifetime || forHeap || forDisk);
 } else {
  return false;
 }
}

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

private AbstractTransactionStore makeTransactional(final Store store) {
  AbstractTransactionStore wrappedStore;
  if (configuration.isXaStrictTransactional()) {
    if (transactionManagerLookup.getTransactionManager() == null) {
      throw new CacheException("You've configured cache " + cacheManager.getName() + "." + configuration.getName()
          + " to be transactional, but no TransactionManager could be found!");
    }
    // set xa enabled
    if (configuration.isTerracottaClustered()) {
      configuration.getTerracottaConfiguration().setCacheXA(true);
    }
    SoftLockManager softLockManager = cacheManager.createSoftLockManager(this);
    TransactionIDFactory transactionIDFactory = cacheManager.getOrCreateTransactionIDFactory();
    wrappedStore = new XATransactionStore(transactionManagerLookup, softLockManager,
        transactionIDFactory, this, store, elementValueComparator);
  } else if (configuration.isXaTransactional()) {
    SoftLockManager softLockManager = cacheManager.createSoftLockManager(this);
    LocalTransactionStore localTransactionStore = new LocalTransactionStore(getCacheManager().getTransactionController(),
        getCacheManager().getOrCreateTransactionIDFactory(), softLockManager, this, store, elementValueComparator);
    wrappedStore = new JtaLocalTransactionStore(localTransactionStore, transactionManagerLookup,
        cacheManager.getTransactionController());
  } else if (configuration.isLocalTransactional()) {
    SoftLockManager softLockManager = cacheManager.createSoftLockManager(this);
    wrappedStore = new LocalTransactionStore(getCacheManager().getTransactionController(), getCacheManager()
        .getOrCreateTransactionIDFactory(), softLockManager, this, store, elementValueComparator);
  } else {
    throw new IllegalStateException("Method should called only with a transactional configuration");
  }
  return wrappedStore;
}

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

} else if (configuration.isXaTransactional()) {
  SoftLockManager softLockManager = cacheManager.createSoftLockManager(this);
  LocalTransactionStore localTransactionStore = new LocalTransactionStore(getCacheManager().getTransactionController(),
      getCacheManager().getOrCreateTransactionIDFactory(), softLockManager, this, store, comparator);
  wrappedStore = new JtaLocalTransactionStore(localTransactionStore, transactionManagerLookup,
      cacheManager.getTransactionController());
} else if (configuration.isLocalTransactional()) {
  SoftLockManager softLockManager = cacheManager.createSoftLockManager(this);
  wrappedStore = new LocalTransactionStore(getCacheManager().getTransactionController(), getCacheManager()
      .getOrCreateTransactionIDFactory(), softLockManager, this, store, comparator);
} else {

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

/**
 * Create using the given cache.
 *
 * @param cache cache
 */
public WriteBehindManager(final Cache cache, final Store store) {
  if (cache.isTerracottaClustered()) {
    writeBehind = ((TerracottaStore)store).createWriteBehind();
  } else if (cache.getCacheConfiguration().getPersistenceConfiguration() != null
      && cache.getCacheConfiguration().getPersistenceConfiguration().getStrategy() == Strategy.LOCALRESTARTABLE) {
    writeBehind = cache.getCacheManager().getFeaturesManager().createWriteBehind(cache);
  } else {
    writeBehind = new WriteBehindQueueManager(cache.getCacheConfiguration());
  }
}

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

/**
 * For use by CacheManager.
 *
 * @param cacheManager the CacheManager for this cache to use.
 */
public void setCacheManager(CacheManager cacheManager) {
  CacheManager oldValue = getCacheManager();
  this.cacheManager = cacheManager;
  firePropertyChange("CacheManager", oldValue, cacheManager);
}

代码示例来源:origin: pentaho/pentaho-reporting

public void shutdown() {
  try {
   dataCache.getCacheManager().shutdown();
  } catch ( Exception e ) {
   logger.debug( "Failed to shut-down cache", e );
   // ignore it ..
  }
 }
}

代码示例来源:origin: pentaho/pentaho-reporting

public void shutdown() {
  try {
   dataCache.getCacheManager().shutdown();
  } catch ( Exception e ) {
   logger.debug( "Failed to shut-down cache", e );
   // ignore it ..
  }
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

private CacheCluster getCacheCluster() {
  CacheCluster cacheCluster;
  try {
    cacheCluster = getCacheManager().getCluster(ClusterScheme.TERRACOTTA);
  } catch (ClusterSchemeNotAvailableException e) {
    LOG.info("Terracotta ClusterScheme is not available, using ClusterScheme.NONE");
    cacheCluster = getCacheManager().getCluster(ClusterScheme.NONE);
  }
  return cacheCluster;
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * For use by CacheManager.
 *
 * @param cacheManager the CacheManager for this cache to use.
 */
public void setCacheManager(CacheManager cacheManager) {
  CacheManager oldValue = getCacheManager();
  this.cacheManager = cacheManager;
  firePropertyChange("CacheManager", oldValue, cacheManager);
}

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

SizeOfEngine sizeOfEngine = cacheManager.createSizeOfEngine(this);
  onHeapPool = new BoundedPool(configuration.getMaxBytesLocalHeap(), evictor, sizeOfEngine);
} else if (getCacheManager() != null && getCacheManager().getConfiguration().isMaxBytesLocalHeapSet()) {
  onHeapPool = getCacheManager().getOnHeapPool();
} else {
  onHeapPool = new UnboundedPool();
  PoolEvictor evictor = new FromLargestCachePoolEvictor();
  onDiskPool = new BoundedPool(configuration.getMaxBytesLocalDisk(), evictor, null);
} else if (getCacheManager() != null && getCacheManager().getConfiguration().isMaxBytesLocalDiskSet()) {
  onDiskPool = getCacheManager().getOnDiskPool();
} else {
  onDiskPool = new UnboundedPool();

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

getCacheManager().getClusteredInstanceFactory().unlinkCache(getName());

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

@Override
public void clusterRejoined(ClusterNode oldNode, ClusterNode newNode) {
  if (newNode.equals(this.cache.getCacheManager().getCluster(ClusterScheme.TERRACOTTA).getCurrentNode())) {
    mostRecentRejoinTimeStamp = System.currentTimeMillis();
    clusterObserver.end(ClusterEventOutcomes.REJOINED);
  }
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

@Override
public void clusterRejoined(ClusterNode oldNode, ClusterNode newNode) {
  if (newNode.equals(this.cache.getCacheManager().getCluster(ClusterScheme.TERRACOTTA).getCurrentNode())) {
    mostRecentRejoinTimeStamp = System.currentTimeMillis();
    clusterObserver.end(ClusterEventOutcomes.REJOINED);
  }
}

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

@Override
public void clusterOffline(ClusterNode node) {
  if (node.equals(this.cache.getCacheManager().getCluster(ClusterScheme.TERRACOTTA).getCurrentNode())) {
    clusterObserver.end(ClusterEventOutcomes.OFFLINE);
  }
}

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

private boolean skipUpdateAccessStatistics(Element element) {
 if (configuration.isFrozen()) {
  boolean forLifetime = element.isEternal();
  boolean forHeap =  configuration.getMaxEntriesLocalHeap() > 0 || configuration.getMaxBytesLocalHeap() > 0
      || getCacheManager().getConfiguration().isMaxBytesLocalHeapSet();
  boolean forDisk = configuration.isOverflowToDisk() && (configuration.getMaxEntriesLocalDisk() > 0 || configuration.getMaxBytesLocalDisk() > 0
      || getCacheManager().getConfiguration().isMaxBytesLocalDiskSet());
  return !(forLifetime || forHeap || forDisk);
 } else {
  return false;
 }
}

相关文章

Cache类方法