当前位置: 首页>>代码示例>>Java>>正文


Java CompleteConfiguration.isStatisticsEnabled方法代码示例

本文整理汇总了Java中javax.cache.configuration.CompleteConfiguration.isStatisticsEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java CompleteConfiguration.isStatisticsEnabled方法的具体用法?Java CompleteConfiguration.isStatisticsEnabled怎么用?Java CompleteConfiguration.isStatisticsEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.cache.configuration.CompleteConfiguration的用法示例。


在下文中一共展示了CompleteConfiguration.isStatisticsEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyBuilder

import javax.cache.configuration.CompleteConfiguration; //导入方法依赖的package包/类
/**
 * Copies the configuration to the target Builder. If the source (configuration)
 * is also a Builder, its fields also get copied. Any null-value in the
 * configuration is ignored in the copying process, leaving the corresponding
 * target value unchanged. The CacheWriteMode can be
 * defined in two ways: If configuration is a Builder it is copied plainly,
 * otherwise it is derived from configuration.isStoreByValue().
 * 
 * @param configuration The source builder
 * @param target The target builder
 */
private void copyBuilder(Configuration<K, V> configuration, Builder<K, V> target)
{
	CacheWriteMode tcacheWriteMode = null;
	if (configuration instanceof Builder)
	{
		Builder<K, V> sourceB = (Builder<K, V>)configuration;
		// tCache native configuration
		if (sourceB.id != null)
			target.id = sourceB.id;
		target.strictJSR107 = sourceB.strictJSR107;
		target.maxCacheTime = sourceB.maxCacheTime;
		target.maxCacheTimeSpread = sourceB.maxCacheTimeSpread;
		this.cleanUpIntervalMillis = sourceB.cleanUpIntervalMillis;
		target.expectedMapSize = sourceB.expectedMapSize;
		target.concurrencyLevel = sourceB.concurrencyLevel;
		if (sourceB.evictionPolicy != null)
			target.evictionPolicy = sourceB.evictionPolicy;
		if (sourceB.evictionClass != null)
			target.evictionClass = sourceB.evictionClass;			
		if (sourceB.hashImplementation != null)
			target.hashImplementation = sourceB.hashImplementation;
		if (sourceB.jamPolicy != null)
			target.jamPolicy = sourceB.jamPolicy;
		if (sourceB.loader != null)
			target.loader = sourceB.loader; // loader vs loaderFactory

		tcacheWriteMode = sourceB.writeMode;
	}
	
	if (configuration instanceof CompleteConfiguration)
	{
		CompleteConfiguration<K,V> cc = (CompleteConfiguration<K,V>)configuration;
		target.statistics = cc.isStatisticsEnabled();
		target.management = cc.isManagementEnabled();
		
		target.expiryPolicyFactory = cc.getExpiryPolicyFactory();
		target.writerFactory = cc.getCacheWriterFactory();
		Factory<javax.cache.integration.CacheLoader<K, V>> lf = cc.getCacheLoaderFactory();
		if (lf != null)
		{
			target.loader = null; // loader vs loaderFactory
			target.loaderFactory = lf;
		}
		
		Collection<CacheEntryListenerConfiguration<K, V>> listenerConfsCopy = new ArrayList<>(0);
		for (CacheEntryListenerConfiguration<K, V> entry : cc.getCacheEntryListenerConfigurations())
		{
			listenerConfsCopy.add(entry);
		}
		target.listenerConfigurations = listenerConfsCopy;
		
		target.writeThrough = cc.isWriteThrough();
		target.readThrough =  cc.isReadThrough();
	}
	
	// JSR107 configuration follows
	if (tcacheWriteMode != null)
		target.writeMode = tcacheWriteMode;
	else
		target.writeMode = CacheWriteMode.fromStoreByValue(configuration.isStoreByValue());
	
	target.keyType = configuration.getKeyType();
	target.valueType = configuration.getValueType();

}
 
开发者ID:trivago,项目名称:triava,代码行数:77,代码来源:Builder.java

示例2: Eh107CompleteConfiguration

import javax.cache.configuration.CompleteConfiguration; //导入方法依赖的package包/类
public Eh107CompleteConfiguration(Configuration<K, V> config, final CacheConfiguration<K, V> ehcacheConfig, boolean useEhcacheExpiry, boolean useEhcacheLoaderWriter) {
  this.ehcacheConfig = ehcacheConfig;
  this.keyType = config.getKeyType();
  this.valueType = config.getValueType();
  this.isStoreByValue = isStoreByValue(config, ehcacheConfig);

  Factory<ExpiryPolicy> tempExpiryPolicyFactory = EternalExpiryPolicy.factoryOf();

  if (config instanceof CompleteConfiguration) {
    CompleteConfiguration<K, V> completeConfig = (CompleteConfiguration<K, V>) config;
    this.isReadThrough = completeConfig.isReadThrough();
    this.isWriteThrough = completeConfig.isWriteThrough();
    this.isStatisticsEnabled = completeConfig.isStatisticsEnabled();
    this.isManagementEnabled = completeConfig.isManagementEnabled();

    if (useEhcacheLoaderWriter) {
      this.cacheLoaderFactory = createThrowingFactory();
      this.cacheWriterFactory = createThrowingFactory();
    } else {
      this.cacheLoaderFactory = completeConfig.getCacheLoaderFactory();
      this.cacheWriterFactory = completeConfig.getCacheWriterFactory();
    }

    tempExpiryPolicyFactory = completeConfig.getExpiryPolicyFactory();
    for (CacheEntryListenerConfiguration<K, V> listenerConfig : completeConfig.getCacheEntryListenerConfigurations()) {
      cacheEntryListenerConfigs.add(listenerConfig);
    }
  } else {
    this.isReadThrough = false;
    this.isWriteThrough = false;
    this.isStatisticsEnabled = false;
    this.isManagementEnabled = false;
    this.cacheLoaderFactory = null;
    this.cacheWriterFactory = null;
  }

  if (useEhcacheExpiry) {
    tempExpiryPolicyFactory = createThrowingFactory();
  }

  this.expiryPolicyFactory = tempExpiryPolicyFactory;
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:43,代码来源:Eh107CompleteConfiguration.java


注:本文中的javax.cache.configuration.CompleteConfiguration.isStatisticsEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。