本文整理汇总了Java中javax.cache.configuration.Configuration.isStoreByValue方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.isStoreByValue方法的具体用法?Java Configuration.isStoreByValue怎么用?Java Configuration.isStoreByValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.cache.configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.isStoreByValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isStoreByValue
import javax.cache.configuration.Configuration; //导入方法依赖的package包/类
private static <K, V> boolean isStoreByValue(Configuration<K, V> config, CacheConfiguration<K, V> ehcacheConfig) {
if(ehcacheConfig != null) {
Collection<ServiceConfiguration<?>> serviceConfigurations = ehcacheConfig.getServiceConfigurations();
for (ServiceConfiguration<?> serviceConfiguration : serviceConfigurations) {
if (serviceConfiguration instanceof DefaultCopierConfiguration) {
DefaultCopierConfiguration<?> copierConfig = (DefaultCopierConfiguration)serviceConfiguration;
if(copierConfig.getType().equals(DefaultCopierConfiguration.Type.VALUE)) {
if(copierConfig.getClazz().isAssignableFrom(IdentityCopier.class)) {
return false;
} else {
return true;
}
}
}
}
}
return config.isStoreByValue();
}
示例2: BlazingCacheCache
import javax.cache.configuration.Configuration; //导入方法依赖的package包/类
public BlazingCacheCache(String cacheName, CacheClient client, CacheManager cacheManager, Serializer<K, String> keysSerializer, Serializer<V, byte[]> valuesSerializer, boolean usefetch, Configuration<K, V> configuration) {
this.cacheName = cacheName;
this.cacheManager = cacheManager;
this.client = client;
this.keysSerializer = keysSerializer;
this.valuesSerializer = valuesSerializer;
this.valueType = configuration.getValueType();
this.keyType = configuration.getKeyType();
this.usefetch = usefetch;
this.configurationMXBean = new BlazingCacheConfigurationMXBean<>(this);
this.statisticsMXBean = new BlazingCacheStatisticsMXBean<>(this);
this.storeByReference = !configuration.isStoreByValue();
if (configuration instanceof CompleteConfiguration) {
this.configuration = new MutableConfiguration<>((CompleteConfiguration<K, V>) configuration);
CompleteConfiguration<K, V> cc = (CompleteConfiguration<K, V>) configuration;
if (cc.getExpiryPolicyFactory() == null) {
throw new IllegalArgumentException("ExpiryPolicyFactory cannot be null");
} else {
ExpiryPolicy _policy = cc.getExpiryPolicyFactory().create();;
if (_policy == null) {
throw new IllegalArgumentException("ExpiryPolicy cannot be null");
}
if (_policy instanceof EternalExpiryPolicy) {
this.policy = null; // shortcut for the most common case
} else {
this.policy = _policy;
}
}
if (cc.getCacheLoaderFactory() != null) {
cacheLoader = (CacheLoader) cc.getCacheLoaderFactory().create();
} else {
cacheLoader = null;
}
if (cc.getCacheWriterFactory() != null) {
cacheWriter = (CacheWriter<K, V>) cc.getCacheWriterFactory().create();
} else {
cacheWriter = null;
}
isReadThrough = cc.isReadThrough();
isWriteThrough = cc.isWriteThrough();
needPreviuosValueForListeners = policy != null;
if (cc.getCacheEntryListenerConfigurations() != null) {
for (CacheEntryListenerConfiguration<K, V> listenerConfig : cc.getCacheEntryListenerConfigurations()) {
configureListener(listenerConfig);
}
}
} else {
this.configuration = new MutableConfiguration<K, V>()
.setTypes(configuration.getKeyType(), configuration.getValueType())
.setStoreByValue(configuration.isStoreByValue());
this.policy = null; // means "eternal"
cacheLoader = null;
needPreviuosValueForListeners = false;
cacheWriter = null;
isReadThrough = false;
isWriteThrough = false;
}
if (isReadThrough && cacheLoader == null) {
throw new IllegalArgumentException("cache isReadThrough=" + isReadThrough + " cacheLoader=" + cacheLoader);
}
if (isWriteThrough && cacheWriter == null) {
throw new IllegalArgumentException("cache isWriteThrough=" + isWriteThrough + " cacheWriter=" + cacheWriter);
}
if (this.configuration.isManagementEnabled()) {
setManagementEnabled(true);
}
if (this.configuration.isStatisticsEnabled()) {
setStatisticsEnabled(true);
}
}