K
- the key typeV
- the value typepublic abstract class AbstractCacheConfig<K,V> extends Object implements CacheConfiguration<K,V>, DataSerializable
CacheConfig
Modifier and Type | Field and Description |
---|---|
protected DeferredValue<javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>>> |
cacheLoaderFactory
The
Factory for the CacheLoader . |
protected DeferredValue<javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>>> |
cacheWriterFactory
The
Factory for the CacheWriter . |
protected ClassLoader |
classLoader
The ClassLoader to be used to resolve key & value types, if set
|
protected DeferredValue<javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy>> |
expiryPolicyFactory
The
Factory for the ExpiryPolicy . |
protected HotRestartConfig |
hotRestartConfig |
protected boolean |
isManagementEnabled
Whether management is enabled
|
protected boolean |
isReadThrough
A flag indicating if "read-through" mode is required.
|
protected boolean |
isStatisticsEnabled
A flag indicating if statistics gathering is enabled.
|
protected boolean |
isStoreByValue
A flag indicating if the cache will be store-by-value or store-by-reference.
|
protected boolean |
isWriteThrough
A flag indicating if "write-through" mode is required.
|
protected Set<DeferredValue<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>> |
listenerConfigurations
The
CacheEntryListenerConfiguration s for the Configuration . |
protected InternalSerializationService |
serializationService |
Constructor and Description |
---|
AbstractCacheConfig() |
AbstractCacheConfig(javax.cache.configuration.CompleteConfiguration<K,V> configuration) |
Modifier and Type | Method and Description |
---|---|
CacheConfiguration<K,V> |
addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Add a configuration for a
CacheEntryListener . |
protected Set<DeferredValue<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>> |
createConcurrentSet() |
boolean |
equals(Object o) |
Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> |
getCacheEntryListenerConfigurations() |
javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> |
getCacheLoaderFactory() |
javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> |
getCacheWriterFactory() |
javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> |
getExpiryPolicyFactory() |
HotRestartConfig |
getHotRestartConfig()
Gets the
HotRestartConfig for this CacheConfiguration |
String |
getKeyClassName() |
Class<K> |
getKeyType() |
Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> |
getListenerConfigurations() |
String |
getValueClassName() |
Class<V> |
getValueType() |
int |
hashCode() |
protected boolean |
hasListenerConfiguration() |
boolean |
isManagementEnabled() |
boolean |
isReadThrough() |
boolean |
isStatisticsEnabled() |
boolean |
isStoreByValue() |
boolean |
isWriteThrough() |
protected boolean |
keyValueTypesEqual(AbstractCacheConfig that) |
CacheConfiguration<K,V> |
removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Remove a configuration for a
CacheEntryListener . |
CacheConfiguration<K,V> |
setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)
Set the
CacheLoader factory. |
CacheConfiguration<K,V> |
setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)
Set the
CacheWriter factory. |
protected void |
setClassLoader(ClassLoader classLoader) |
CacheConfiguration<K,V> |
setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)
Set the
Factory for the ExpiryPolicy . |
CacheConfiguration<K,V> |
setHotRestartConfig(HotRestartConfig hotRestartConfig)
Sets the
HotRestartConfig for this CacheConfiguration |
CacheConfiguration<K,V> |
setKeyClassName(String keyClassName) |
CacheConfiguration<K,V> |
setKeyType(Class<K> keyType) |
CacheConfiguration<K,V> |
setListenerConfigurations() |
protected CacheConfiguration<K,V> |
setListenerConfigurations(Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> listeners) |
CacheConfiguration<K,V> |
setManagementEnabled(boolean enabled)
Sets whether or not management is enabled on this cache.
|
CacheConfiguration<K,V> |
setReadThrough(boolean isReadThrough)
Set if read-through caching should be used.
|
CacheConfiguration<K,V> |
setStatisticsEnabled(boolean enabled)
Sets whether or not statistics gathering is enabled on this cache.
|
CacheConfiguration<K,V> |
setStoreByValue(boolean storeByValue)
Set if a configured cache should use store-by-value or store-by-reference
semantics.
|
CacheConfiguration<K,V> |
setTypes(Class<K> keyType,
Class<V> valueType)
Sets the expected type of keys and values for a
Cache
configured with this Configuration . |
CacheConfiguration<K,V> |
setValueClassName(String valueClassName) |
CacheConfiguration<K,V> |
setValueType(Class<V> valueType) |
CacheConfiguration<K,V> |
setWriteThrough(boolean isWriteThrough)
Set if write-through caching should be used.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
readData, writeData
protected DeferredValue<javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>>> cacheLoaderFactory
Factory
for the CacheLoader
.protected DeferredValue<javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>>> cacheWriterFactory
Factory
for the CacheWriter
.protected DeferredValue<javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy>> expiryPolicyFactory
Factory
for the ExpiryPolicy
.protected boolean isReadThrough
protected boolean isWriteThrough
protected boolean isStatisticsEnabled
protected boolean isStoreByValue
protected boolean isManagementEnabled
protected HotRestartConfig hotRestartConfig
protected transient ClassLoader classLoader
protected transient InternalSerializationService serializationService
protected Set<DeferredValue<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>> listenerConfigurations
CacheEntryListenerConfiguration
s for the Configuration
.public CacheConfiguration<K,V> addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
CacheEntryListener
.addCacheEntryListenerConfiguration
in interface CacheConfiguration<K,V>
cacheEntryListenerConfiguration
- the CacheEntryListenerConfiguration
CacheConfig
IllegalArgumentException
- if the same CacheEntryListenerConfiguration
is used more than oncepublic CacheConfiguration<K,V> removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
CacheEntryListener
.removeCacheEntryListenerConfiguration
in interface CacheConfiguration<K,V>
cacheEntryListenerConfiguration
- the CacheEntryListenerConfiguration
to removeCacheConfig
public Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> getCacheEntryListenerConfigurations()
public boolean isReadThrough()
public CacheConfiguration<K,V> setReadThrough(boolean isReadThrough)
CacheConfiguration
It is an invalid configuration to set this to true
without specifying a
CacheLoader
Factory
.
setReadThrough
in interface CacheConfiguration<K,V>
isReadThrough
- true
if read-through is required, false
otherwiseCacheConfiguration
to permit fluent-style method callspublic boolean isWriteThrough()
public CacheConfiguration<K,V> setWriteThrough(boolean isWriteThrough)
CacheConfiguration
It is an invalid configuration to set this to true
without specifying a
CacheWriter
Factory
.
setWriteThrough
in interface CacheConfiguration<K,V>
isWriteThrough
- true
if write-through is required, false
otherwiseCacheConfiguration
to permit fluent-style method callspublic boolean isStatisticsEnabled()
public CacheConfiguration<K,V> setStatisticsEnabled(boolean enabled)
Statistics may be enabled or disabled at runtime via CacheManager.enableStatistics(String, boolean)
.
setStatisticsEnabled
in interface CacheConfiguration<K,V>
enabled
- true
to enable statistics, false
to disableCacheConfig
public boolean isManagementEnabled()
public CacheConfiguration<K,V> setManagementEnabled(boolean enabled)
Management may be enabled or disabled at runtime via CacheManager.enableManagement(String, boolean)
.
setManagementEnabled
in interface CacheConfiguration<K,V>
enabled
- true
to enable statistics, false
to disableCacheConfig
public HotRestartConfig getHotRestartConfig()
HotRestartConfig
for this CacheConfiguration
public CacheConfiguration<K,V> setHotRestartConfig(HotRestartConfig hotRestartConfig)
HotRestartConfig
for this CacheConfiguration
hotRestartConfig
- hot restart configCacheConfiguration
instancepublic javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> getCacheLoaderFactory()
public CacheConfiguration<K,V> setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)
CacheConfiguration
CacheLoader
factory.setCacheLoaderFactory
in interface CacheConfiguration<K,V>
cacheLoaderFactory
- the CacheLoader
Factory
CacheConfiguration
to permit fluent-style method callspublic CacheConfiguration<K,V> setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)
CacheConfiguration
Factory
for the ExpiryPolicy
.
If null
is specified the default ExpiryPolicy
is used.setExpiryPolicyFactory
in interface CacheConfiguration<K,V>
expiryPolicyFactory
- the ExpiryPolicy
Factory
CacheConfiguration
to permit fluent-style method callspublic CacheConfiguration<K,V> setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)
CacheConfiguration
CacheWriter
factory.setCacheWriterFactory
in interface CacheConfiguration<K,V>
cacheWriterFactory
- the CacheWriter
Factory
CacheConfiguration
to permit fluent-style method callspublic javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> getCacheWriterFactory()
public javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> getExpiryPolicyFactory()
public String getKeyClassName()
public CacheConfiguration<K,V> setKeyClassName(String keyClassName)
public String getValueClassName()
public CacheConfiguration<K,V> setValueClassName(String valueClassName)
public CacheConfiguration<K,V> setTypes(Class<K> keyType, Class<V> valueType)
Cache
configured with this Configuration
.
Setting both to Object.class
means type-safety checks are not required.
This is used by CacheManager
to ensure that the key and value
types are the same as those configured for the Cache
prior to
returning a requested cache from this method.
Implementations may further perform type checking on mutative cache operations
and throw a ClassCastException
if these checks fail.
setTypes
in interface CacheConfiguration<K,V>
keyType
- the expected key typevalueType
- the expected value typeCacheConfig
NullPointerException
- should the key or value type be nullCacheManager.getCache(String, Class, Class)
public boolean isStoreByValue()
public CacheConfiguration<K,V> setStoreByValue(boolean storeByValue)
setStoreByValue
in interface CacheConfiguration<K,V>
storeByValue
- true
if store-by-value is required,
false
for store-by-referenceCacheConfig
protected Set<DeferredValue<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>> createConcurrentSet()
public CacheConfiguration<K,V> setKeyType(Class<K> keyType)
public CacheConfiguration<K,V> setValueType(Class<V> valueType)
public CacheConfiguration<K,V> setListenerConfigurations()
protected CacheConfiguration<K,V> setListenerConfigurations(Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> listeners)
public Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> getListenerConfigurations()
protected boolean hasListenerConfiguration()
protected void setClassLoader(ClassLoader classLoader)
protected boolean keyValueTypesEqual(AbstractCacheConfig that)
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.