net.sf.ehcache.config.Configuration.getAllActiveCaches()方法的使用及代码示例

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

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

Configuration.getAllActiveCaches介绍

[英]Returns all active caches managed by the Manager
[中]返回管理器管理的所有活动缓存

代码示例

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

private static void validateOverAllocation(RuntimeCfg config,  Long newValue) {
  ArrayList<ConfigError> errors = new ArrayList<ConfigError>();
  for (Cache cache : getAllActiveCaches(config.cacheManager)) {
    CacheConfiguration cacheConfiguration = cache.getCacheConfiguration();
    errors.addAll(cacheConfiguration.validateCachePools(config.getConfiguration()));
    errors.addAll(cacheConfiguration.verifyPoolAllocationsBeforeAddingTo(config.cacheManager,
      newValue, config.getConfiguration().getMaxBytesLocalOffHeap(),
        config.getConfiguration().getMaxBytesLocalDisk(), null));
  }
  if (!errors.isEmpty()) {
    throw new InvalidConfigurationException("Can't reduce CacheManager byte tuning by so much", errors);
  }
}

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

@Override
  void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
    Long newValue = (Long)evt.getNewValue();
    Long oldValue = (Long) evt.getOldValue();
    if (oldValue > newValue) {
      // Double check for over-allocation again
      validateOverAllocation(config, newValue);
    }
    // Recalculate % based caches
    long cacheAllocated = 0;
    for (Cache cache : getAllActiveCaches(config.cacheManager)) {
      cache.getCacheConfiguration().configCachePools(config.getConfiguration());
      long bytesLocalHeap = cache.getCacheConfiguration().getMaxBytesLocalHeap();
      cacheAllocated += bytesLocalHeap;
    }
    config.cacheManager.getOnHeapPool().setMaxSize(newValue - cacheAllocated);
  }
},

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

@Override
  void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
    Long newValue = (Long) evt.getNewValue();
    Long oldValue = (Long) evt.getOldValue();
    if (oldValue > newValue) {
      // Double check for over-allocation again
      validateOverAllocation(config, newValue);
    }
    long diskAllocated = 0;
    //Recalculating final free space available at global level
    for (Cache cache : getAllActiveCaches(config.cacheManager)) {
     cache.getCacheConfiguration().configCachePools(config.getConfiguration());
     long bytesOnDiskPool = cache.getCacheConfiguration().getMaxBytesLocalDisk();
     diskAllocated += bytesOnDiskPool;
    }
    config.cacheManager.getOnDiskPool().setMaxSize(newValue - diskAllocated);
  }
};

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

for (Cache cache : getAllActiveCaches(cacheManager)) {
  if (cache.getName().equals(parentCacheName)) {

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

private static void validateOverAllocation(RuntimeCfg config,  Long newValue) {
  ArrayList<ConfigError> errors = new ArrayList<ConfigError>();
  for (Cache cache : getAllActiveCaches(config.cacheManager)) {
    CacheConfiguration cacheConfiguration = cache.getCacheConfiguration();
    errors.addAll(cacheConfiguration.validateCachePools(config.getConfiguration()));
    errors.addAll(cacheConfiguration.verifyPoolAllocationsBeforeAddingTo(config.cacheManager,
      newValue, config.getConfiguration().getMaxBytesLocalOffHeap(),
        config.getConfiguration().getMaxBytesLocalDisk(), null));
  }
  if (!errors.isEmpty()) {
    throw new InvalidConfigurationException("Can't reduce CacheManager byte tuning by so much", errors);
  }
}

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

private static void validateOverAllocation(RuntimeCfg config,  Long newValue) {
  ArrayList<ConfigError> errors = new ArrayList<ConfigError>();
  for (Cache cache : getAllActiveCaches(config.cacheManager)) {
    CacheConfiguration cacheConfiguration = cache.getCacheConfiguration();
    errors.addAll(cacheConfiguration.validateCachePools(config.getConfiguration()));
    errors.addAll(cacheConfiguration.verifyPoolAllocationsBeforeAddingTo(config.cacheManager,
      newValue, config.getConfiguration().getMaxBytesLocalOffHeap(),
        config.getConfiguration().getMaxBytesLocalDisk(), null));
  }
  if (!errors.isEmpty()) {
    throw new InvalidConfigurationException("Can't reduce CacheManager byte tuning by so much", errors);
  }
}

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

@Override
  void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
    Long newValue = (Long)evt.getNewValue();
    Long oldValue = (Long) evt.getOldValue();
    if (oldValue > newValue) {
      // Double check for over-allocation again
      validateOverAllocation(config, newValue);
    }
    // Recalculate % based caches
    long cacheAllocated = 0;
    for (Cache cache : getAllActiveCaches(config.cacheManager)) {
      cache.getCacheConfiguration().configCachePools(config.getConfiguration());
      long bytesLocalHeap = cache.getCacheConfiguration().getMaxBytesLocalHeap();
      cacheAllocated += bytesLocalHeap;
    }
    config.cacheManager.getOnHeapPool().setMaxSize(newValue - cacheAllocated);
  }
},

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

@Override
  void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
    Long newValue = (Long) evt.getNewValue();
    Long oldValue = (Long) evt.getOldValue();
    if (oldValue > newValue) {
      // Double check for over-allocation again
      validateOverAllocation(config, newValue);
    }
    long diskAllocated = 0;
    //Recalculating final free space available at global level
    for (Cache cache : getAllActiveCaches(config.cacheManager)) {
     cache.getCacheConfiguration().configCachePools(config.getConfiguration());
     long bytesOnDiskPool = cache.getCacheConfiguration().getMaxBytesLocalDisk();
     diskAllocated += bytesOnDiskPool;
    }
    config.cacheManager.getOnDiskPool().setMaxSize(newValue - diskAllocated);
  }
};

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

@Override
  void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
    Long newValue = (Long) evt.getNewValue();
    Long oldValue = (Long) evt.getOldValue();
    if (oldValue > newValue) {
      // Double check for over-allocation again
      validateOverAllocation(config, newValue);
    }
    long diskAllocated = 0;
    //Recalculating final free space available at global level
    for (Cache cache : getAllActiveCaches(config.cacheManager)) {
     cache.getCacheConfiguration().configCachePools(config.getConfiguration());
     long bytesOnDiskPool = cache.getCacheConfiguration().getMaxBytesLocalDisk();
     diskAllocated += bytesOnDiskPool;
    }
    config.cacheManager.getOnDiskPool().setMaxSize(newValue - diskAllocated);
  }
};

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

@Override
  void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
    Long newValue = (Long)evt.getNewValue();
    Long oldValue = (Long) evt.getOldValue();
    if (oldValue > newValue) {
      // Double check for over-allocation again
      validateOverAllocation(config, newValue);
    }
    // Recalculate % based caches
    long cacheAllocated = 0;
    for (Cache cache : getAllActiveCaches(config.cacheManager)) {
      cache.getCacheConfiguration().configCachePools(config.getConfiguration());
      long bytesLocalHeap = cache.getCacheConfiguration().getMaxBytesLocalHeap();
      cacheAllocated += bytesLocalHeap;
    }
    config.cacheManager.getOnHeapPool().setMaxSize(newValue - cacheAllocated);
  }
},

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

@Override
  void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
    ArrayList<ConfigError> errors = new ArrayList<ConfigError>();
    Long newValue = (Long)evt.getNewValue();
    if ((Long) evt.getOldValue() > (Long) evt.getNewValue()) {
      // Double check for over-allocation again
      for (Cache cache : getAllActiveCaches(config.cacheManager)) {
        CacheConfiguration cacheConfiguration = cache.getCacheConfiguration();
        errors.addAll(cacheConfiguration.validateCachePools(config.getConfiguration()));
        errors.addAll(cacheConfiguration.verifyPoolAllocationsBeforeAddingTo(config.cacheManager,
          newValue, config.getConfiguration().getMaxBytesLocalOffHeap(), config.getConfiguration().getMaxBytesLocalDisk()));
      }
    }
    if (!errors.isEmpty()) {
      throw new InvalidConfigurationException("Can't reduce CacheManager byte tuning by so much", errors);
    }
    // Recalculate % based caches
    long cacheAllocated = 0;
    for (Cache cache : getAllActiveCaches(config.cacheManager)) {
      cache.getCacheConfiguration().configCachePools(config.getConfiguration());
      long bytesLocalHeap = cache.getCacheConfiguration().getMaxBytesLocalHeap();
      cacheAllocated += bytesLocalHeap;
    }
    config.cacheManager.getOnHeapPool().setMaxSize(newValue - cacheAllocated);
  }
},

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

for (Cache cache : getAllActiveCaches(cacheManager)) {
  isUpdate = cache.getName().equals(getName()) || isUpdate;
  final CacheConfiguration config = cache.getCacheConfiguration();

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

for (Cache cache : getAllActiveCaches(cacheManager)) {
  if (cache.getName().equals(parentCacheName)) {

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

for (Cache cache : getAllActiveCaches(cacheManager)) {
  if (cache.getName().equals(parentCacheName)) {

相关文章

Configuration类方法