K - the type of keys maintained the cacheV - the type of cached valuespublic class MutableConfiguration<K,V> extends Configuration<K,V>
Configuration.| Modifier and Type | Field and Description |
|---|---|
protected Factory<CacheLoader<K,V>> |
cacheLoaderFactory
The
Factory for the CacheLoader. |
protected Factory<CacheWriter<? super K,? super V>> |
cacheWriterFactory
The
Factory for the CacheWriter. |
protected Factory<ExpiryPolicy<? super K>> |
expiryPolicyFactory
The
Factory for the ExpiryPolicy. |
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 |
isTransactionsEnabled
A flag indicating if the cache will use transactions.
|
protected boolean |
isWriteThrough
A flag indicating if "write-through" mode is required.
|
protected Class<K> |
keyType
The type of keys for
Caches configured with this
Configuration. |
protected ArrayList<CacheEntryListenerConfiguration<K,V>> |
listenerConfigurations
The
CacheEntryListenerConfigurations for the Configuration. |
static long |
serialVersionUID
The serialVersionUID required for
Serializable. |
protected IsolationLevel |
txnIsolationLevel
The transaction
IsolationLevel. |
protected Mode |
txnMode
The transaction
Mode. |
protected Class<V> |
valueType
The type of values for
Caches configured with this
Configuration. |
| Constructor and Description |
|---|
MutableConfiguration()
Constructs a default
MutableConfiguration. |
MutableConfiguration(Configuration<K,V> configuration)
Constructs a
MutableConfiguration based on another
Configuration. |
| Modifier and Type | Method and Description |
|---|---|
MutableConfiguration<K,V> |
addCacheEntryListenerConfiguration(CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Add a configuration for a
CacheEntryListener. |
boolean |
equals(Object object) |
List<CacheEntryListenerConfiguration<K,V>> |
getCacheEntryListenerConfigurations()
|
Factory<CacheLoader<K,V>> |
getCacheLoaderFactory()
Gets the
Factory for the CacheLoader, if
any. |
Factory<CacheWriter<? super K,? super V>> |
getCacheWriterFactory()
Gets the
Factory for the CacheWriter, if
any. |
Factory<ExpiryPolicy<? super K>> |
getExpiryPolicyFactory()
Gets the
Factory for the ExpiryPolicy to be used
for caches. |
Class<K> |
getKeyType()
Determines the required type of keys for
Caches configured
with this Configuration. |
IsolationLevel |
getTransactionIsolationLevel()
Gets the transaction isolation level.
|
Mode |
getTransactionMode()
Gets the transaction mode.
|
Class<V> |
getValueType()
Determines the required type of values for
Caches configured
with this Configuration. |
int |
hashCode() |
boolean |
isManagementEnabled()
Checks whether management is enabled on this cache.
|
boolean |
isReadThrough()
Determines if a
Cache should operate in read-through mode. |
boolean |
isStatisticsEnabled()
Checks whether statistics collection is enabled in this cache.
|
boolean |
isStoreByValue()
Whether storeByValue (true) or storeByReference (false).
|
boolean |
isTransactionsEnabled()
Checks whether transactions are enabled for this cache.
|
boolean |
isWriteThrough()
Determines if a
Cache should operate in write-through mode. |
MutableConfiguration<K,V> |
setCacheLoaderFactory(Factory<? extends CacheLoader<K,V>> factory)
Set the
CacheLoader factory. |
MutableConfiguration<K,V> |
setCacheWriterFactory(Factory<? extends CacheWriter<? super K,? super V>> factory)
Set the
CacheWriter factory. |
MutableConfiguration<K,V> |
setExpiryPolicyFactory(Factory<? extends ExpiryPolicy<? super K>> factory)
Set the
Factory for the ExpiryPolicy. |
MutableConfiguration<K,V> |
setManagementEnabled(boolean enabled)
Sets whether management is enabled on a cache.
|
MutableConfiguration<K,V> |
setReadThrough(boolean isReadThrough)
Set if read-through caching should be used.
|
MutableConfiguration<K,V> |
setStatisticsEnabled(boolean enabled)
Sets whether statistics gathering is enabled on a cache.
|
MutableConfiguration<K,V> |
setStoreByValue(boolean isStoreByValue)
Set if a configured cache should use store-by-value or store-by-reference
semantics.
|
MutableConfiguration<K,V> |
setTransactions(IsolationLevel level,
Mode mode)
|
MutableConfiguration<K,V> |
setTypes(Class<K> keyType,
Class<V> valueType)
Sets the expected type of keys and values for a
Cache
configured with this Configuration. |
MutableConfiguration<K,V> |
setWriteThrough(boolean isWriteThrough)
Set if write-through caching should be used.
|
public static final long serialVersionUID
Serializable.protected Class<K> keyType
Caches configured with this
Configuration.protected Class<V> valueType
Caches configured with this
Configuration.protected ArrayList<CacheEntryListenerConfiguration<K,V>> listenerConfigurations
CacheEntryListenerConfigurations for the Configuration.protected Factory<CacheLoader<K,V>> cacheLoaderFactory
Factory for the CacheLoader.protected Factory<CacheWriter<? super K,? super V>> cacheWriterFactory
Factory for the CacheWriter.protected Factory<ExpiryPolicy<? super K>> expiryPolicyFactory
Factory for the ExpiryPolicy.protected boolean isReadThrough
protected boolean isWriteThrough
protected boolean isStatisticsEnabled
protected boolean isStoreByValue
protected boolean isTransactionsEnabled
protected IsolationLevel txnIsolationLevel
IsolationLevel.protected boolean isManagementEnabled
public MutableConfiguration()
MutableConfiguration.public MutableConfiguration(Configuration<K,V> configuration)
MutableConfiguration based on another
Configuration.configuration - the Configurationpublic Class<K> getKeyType()
Caches configured
with this Configuration.getKeyType in class Configuration<K,V>Object.class if the type is undefinedpublic Class<V> getValueType()
Caches configured
with this Configuration.getValueType in class Configuration<K,V>Object.class if the type is undefinedpublic MutableConfiguration<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.keyType - the expected key typevalueType - the expected value typeMutableConfiguration to permit fluent-style method callsNullPointerException - should the key or value type be nullpublic List<CacheEntryListenerConfiguration<K,V>> getCacheEntryListenerConfigurations()
getCacheEntryListenerConfigurations in class Configuration<K,V>Iterable over the CacheEntryListenerConfigurationspublic MutableConfiguration<K,V> addCacheEntryListenerConfiguration(CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
CacheEntryListener.cacheEntryListenerConfiguration - the
CacheEntryListenerConfigurationMutableConfiguration to permit fluent-style method callsIllegalArgumentException - is the same CacheEntryListenerConfiguration
is used more than oncepublic Factory<CacheLoader<K,V>> getCacheLoaderFactory()
Factory for the CacheLoader, if
any.
A CacheLoader should be configured for "Read Through" caches
to load values when a cache miss occurs using either the
Cache.get(Object) and/or Cache.getAll(java.util.Set)
methods.
The default value is null.getCacheLoaderFactory in class Configuration<K,V>Factory for the CacheLoader or
null if none has been set.public MutableConfiguration<K,V> setCacheLoaderFactory(Factory<? extends CacheLoader<K,V>> factory)
CacheLoader factory.factory - the CacheLoader FactoryMutableConfiguration to permit fluent-style method callspublic Factory<CacheWriter<? super K,? super V>> getCacheWriterFactory()
getCacheWriterFactory in class Configuration<K,V>Factory for the CacheWriter or
null if none has been set.public MutableConfiguration<K,V> setCacheWriterFactory(Factory<? extends CacheWriter<? super K,? super V>> factory)
CacheWriter factory.factory - the CacheWriter FactoryMutableConfiguration to permit fluent-style method callspublic Factory<ExpiryPolicy<? super K>> getExpiryPolicyFactory()
Factory for the ExpiryPolicy to be used
for caches.
The default value is a Factory that will produce a
EternalExpiryPolicy instance.getExpiryPolicyFactory in class Configuration<K,V>Factory for ExpiryPolicy (must not be
null)public MutableConfiguration<K,V> setExpiryPolicyFactory(Factory<? extends ExpiryPolicy<? super K>> factory)
factory - the ExpiryPolicy FactoryMutableConfiguration to permit fluent-style method callspublic IsolationLevel getTransactionIsolationLevel()
IsolationLevel.NONE.getTransactionIsolationLevel in class Configuration<K,V>public MutableConfiguration<K,V> setTransactions(IsolationLevel level, Mode mode)
level - the IsolationLevelmode - the ModeMutableConfiguration to permit fluent-style method callspublic Mode getTransactionMode()
Mode.NONE.getTransactionMode in class Configuration<K,V>public boolean isReadThrough()
Cache should operate in read-through mode.
When in "read-through" mode, cache misses that occur due to cache entries
not existing as a result of performing a "get" will appropriately
cause
the configured CacheLoader to be invoked.
The default value is false.isReadThrough in class Configuration<K,V>true when a Cache is in "read-through"
mode.Configuration.getCacheLoaderFactory()public MutableConfiguration<K,V> setReadThrough(boolean isReadThrough)
CacheLoader Factory.isReadThrough - true if read-through is requiredMutableConfiguration to permit fluent-style method callspublic boolean isWriteThrough()
Cache should operate in write-through mode.
When in "write-through" mode, cache updates that occur as a result of performing
"put" operations called via one of Cache.put(Object, Object),
Cache.getAndRemove(Object),
Cache.removeAll(), Cache.getAndPut(Object,
Object)
Cache.getAndRemove(Object), Cache.getAndReplace(Object,
Object),
Cache.invoke(Object, javax.cache.processor.EntryProcessor,
Object...),
Cache.invokeAll(java.util.Set, javax.cache.processor.EntryProcessor,
Object...)
will appropriately cause the configured CacheWriter
to be invoked.
The default value is false.isWriteThrough in class Configuration<K,V>true when a Cache is in "write-through"
mode.Configuration.getCacheWriterFactory()public MutableConfiguration<K,V> setWriteThrough(boolean isWriteThrough)
CacheWriter Factory.isWriteThrough - true if write-through is requiredMutableConfiguration to permit fluent-style method callspublic boolean isStoreByValue()
true.isStoreByValue in class Configuration<K,V>public MutableConfiguration<K,V> setStoreByValue(boolean isStoreByValue)
isStoreByValue - true if store-by-value is required,
false for store-by-referenceMutableConfiguration to permit fluent-style method callspublic boolean isStatisticsEnabled()
false.isStatisticsEnabled in class Configuration<K,V>public MutableConfiguration<K,V> setStatisticsEnabled(boolean enabled)
CacheManager.enableStatistics(String, boolean).enabled - true to enable statistics, false to disable.MutableConfiguration to permit fluent-style method callspublic boolean isManagementEnabled()
false.isManagementEnabled in class Configuration<K,V>public MutableConfiguration<K,V> setManagementEnabled(boolean enabled)
CacheManager.enableManagement(String, boolean).enabled - true to enable statistics, false to disable.MutableConfiguration to permit fluent-style method callspublic boolean isTransactionsEnabled()
false.isTransactionsEnabled in class Configuration<K,V>Copyright © 2013. All Rights Reserved.