K - the type of keys maintained the cacheV - the type of cached valuespublic class MutableConfiguration<K,V> extends Object implements Configuration<K,V>
Configuration.Configuration.Duration| Modifier and Type | Field and Description |
|---|---|
protected ArrayList<CacheEntryListenerRegistration<? super K,? super V>> |
cacheEntryListenerRegistrations
The
CacheEntryListenerRegistrations for the Configuration. |
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,? super V>> |
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 IsolationLevel |
txnIsolationLevel
The transaction
IsolationLevel. |
protected Mode |
txnMode
The transaction
Mode. |
| Constructor and Description |
|---|
MutableConfiguration()
Constructs an
MutableConfiguration with the standard
default values. |
MutableConfiguration(Configuration<K,V> configuration)
A copy-constructor for a
MutableConfiguration. |
MutableConfiguration(Iterable<CacheEntryListenerRegistration<? super K,? super V>> cacheEntryListenerRegistrations,
Factory<CacheLoader<K,V>> cacheLoaderFactory,
Factory<CacheWriter<? super K,? super V>> cacheWriterFactory,
Factory<ExpiryPolicy<? super K,? super V>> expiryPolicyFactory,
boolean isReadThrough,
boolean isWriteThrough,
boolean isStatisticsEnabled,
boolean isStoreByValue,
boolean isTransactionsEnabled,
IsolationLevel txnIsolationLevel,
Mode txnMode)
Constructs a
MutableConfiguration based on a set of parameters. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object object) |
Iterable<CacheEntryListenerRegistration<? super K,? super V>> |
getCacheEntryListenerRegistrations()
Obtains the
CacheEntryListenerRegistrations for CacheEntryListeners
to be configured on a Cache. |
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,? super V>> |
getExpiryPolicyFactory()
Gets the
Factory for the ExpiryPolicy to be used for caches. |
IsolationLevel |
getTransactionIsolationLevel()
Gets the transaction isolation level.
|
Mode |
getTransactionMode()
Gets the transaction mode.
|
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> |
registerCacheEntryListener(CacheEntryListener<? super K,? super V> cacheEntryListener,
boolean requireOldValue,
CacheEntryEventFilter<? super K,? super V> cacheEntryEventFilter,
boolean synchronous)
Add a
CacheEntryListener. |
MutableConfiguration<K,V> |
setCacheLoaderFactory(Factory<? extends CacheLoader<K,V>> factory)
Set the
CacheLoader. |
MutableConfiguration<K,V> |
setCacheWriterFactory(Factory<? extends CacheWriter<? super K,? super V>> factory)
Set the
CacheWriter. |
MutableConfiguration<K,V> |
setExpiryPolicyFactory(Factory<? extends ExpiryPolicy<? super K,? super V>> 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> |
setTransactionMode(Mode mode)
Set the Transaction
Mode. |
MutableConfiguration<K,V> |
setTransactions(IsolationLevel level,
Mode mode)
Set the Transaction
IsolationLevel and Mode. |
MutableConfiguration<K,V> |
setTransactionsEnabled(boolean isTransactionsEnabled)
Set if transactions should be enabled.
|
MutableConfiguration<K,V> |
setWriteThrough(boolean isWriteThrough)
Set if write-through caching should be used.
|
protected ArrayList<CacheEntryListenerRegistration<? super K,? super V>> cacheEntryListenerRegistrations
CacheEntryListenerRegistrations 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,? super V>> 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 with the standard
default values.public MutableConfiguration(Iterable<CacheEntryListenerRegistration<? super K,? super V>> cacheEntryListenerRegistrations, Factory<CacheLoader<K,V>> cacheLoaderFactory, Factory<CacheWriter<? super K,? super V>> cacheWriterFactory, Factory<ExpiryPolicy<? super K,? super V>> expiryPolicyFactory, boolean isReadThrough, boolean isWriteThrough, boolean isStatisticsEnabled, boolean isStoreByValue, boolean isTransactionsEnabled, IsolationLevel txnIsolationLevel, Mode txnMode)
MutableConfiguration based on a set of parameters.cacheEntryListenerRegistrations - the CacheEntryListenerRegistrationscacheLoaderFactory - the CacheLoader FactorycacheWriterFactory - the CacheWriter FactoryexpiryPolicyFactory - the ExpiryPolicy FactoryisReadThrough - is read-through caching supportedisWriteThrough - is write-through caching supportedisStatisticsEnabled - are statistics enabledisStoreByValue - true if the "store-by-value" more
or false for "store-by-reference"isTransactionsEnabled - true if transactions are enabledtxnIsolationLevel - the IsolationLeveltxnMode - the Modepublic MutableConfiguration(Configuration<K,V> configuration)
MutableConfiguration.configuration - the Configuration from which to copypublic Iterable<CacheEntryListenerRegistration<? super K,? super V>> getCacheEntryListenerRegistrations()
CacheEntryListenerRegistrations for CacheEntryListeners
to be configured on a Cache.getCacheEntryListenerRegistrations in interface Configuration<K,V>Iterable over the CacheEntryListenerRegistrationspublic MutableConfiguration<K,V> registerCacheEntryListener(CacheEntryListener<? super K,? super V> cacheEntryListener, boolean requireOldValue, CacheEntryEventFilter<? super K,? super V> cacheEntryEventFilter, boolean synchronous)
CacheEntryListener. If the specified
CacheEntryListenerRegistration is already known, the request to
add it is ignored.cacheEntryListener - the CacheEntryListenerrequireOldValue - whether the old value is supplied to CacheEntryEvent.cacheEntryEventFilter - the CacheEntryEventFiltersynchronous - whether the caller is blocked until the listener invocation completes.public 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 interface 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 - the CacheLoader FactoryMutableConfiguration to permit fluent-style method callspublic Factory<CacheWriter<? super K,? super V>> getCacheWriterFactory()
getCacheWriterFactory in interface 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 - the CacheWriter FactoryMutableConfiguration to permit fluent-style method callspublic Factory<ExpiryPolicy<? super K,? super V>> getExpiryPolicyFactory()
Factory for the ExpiryPolicy to be used for caches.
The default value is a Factory that will produce a
ExpiryPolicy.Default instance.getExpiryPolicyFactory in interface Configuration<K,V>Factory for ExpiryPolicy (must not be null)public MutableConfiguration<K,V> setExpiryPolicyFactory(Factory<? extends ExpiryPolicy<? super K,? super V>> factory)
factory - the ExpiryPolicy FactoryMutableConfiguration to permit fluent-style method callspublic IsolationLevel getTransactionIsolationLevel()
IsolationLevel.NONE.getTransactionIsolationLevel in interface Configuration<K,V>public MutableConfiguration<K,V> setTransactions(IsolationLevel level, Mode mode)
IsolationLevel and Mode.level - the IsolationLevelmode - the ModeMutableConfiguration to permit fluent-style method callspublic Mode getTransactionMode()
Mode.NONE.getTransactionMode in interface Configuration<K,V>public MutableConfiguration<K,V> setTransactionMode(Mode mode)
Mode.mode - the ModeMutableConfiguration to permit fluent-style method callspublic 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" call via one of Cache.get(Object),
Cache.getAll(java.util.Set), Cache.getAndRemove(Object) and/or
Cache.getAndReplace(Object, Object) will appropriately cause
the configured CacheLoader to be invoked.
The default value is false.isReadThrough in interface Configuration<K,V>true when a Cache is in "read-through" mode.Configuration.getCacheLoaderFactory()public MutableConfiguration<K,V> setReadThrough(boolean isReadThrough)
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#invokeEntryProcessor(Object, javax.cache.Cache.EntryProcessor)
will appropriately cause the configured CacheWriter to be invoked.
The default value is false.isWriteThrough in interface Configuration<K,V>true when a Cache is in "write-through" mode.Configuration.getCacheWriterFactory()public MutableConfiguration<K,V> setWriteThrough(boolean isWriteThrough)
isWriteThrough - true if write-through is requiredMutableConfiguration to permit fluent-style method callspublic boolean isStoreByValue()
true.isStoreByValue in interface Configuration<K,V>public MutableConfiguration<K,V> setStoreByValue(boolean isStoreByValue)
isStoreByValue - true if "store-by-value" is required,
false for "store-by-reference"MutableConfiguration to permit fluent-style method callspublic boolean isStatisticsEnabled()
false.isStatisticsEnabled in interface 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 interface 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 interface Configuration<K,V>public MutableConfiguration<K,V> setTransactionsEnabled(boolean isTransactionsEnabled)
isTransactionsEnabled - true if transactions should be enabledMutableConfiguration to permit fluent-style method callsCopyright © 2013. All Rights Reserved.