|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.cache.MutableConfiguration<K,V>
K - the type of keys maintained the cacheV - the type of cached valuespublic class MutableConfiguration<K,V>
A simple mutable implementation of a Configuration.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface javax.cache.Configuration |
|---|
Configuration.Duration |
| Field Summary | |
|---|---|
protected ArrayList<CacheEntryListenerRegistration<? super K,? super V>> |
cacheEntryListenerRegistrations
The CacheEntryListenerRegistrations for the Configuration. |
protected CacheLoader<K,? extends V> |
cacheLoader
The CacheLoader for the built Configuration. |
protected CacheWriter<? super K,? super V> |
cacheWriter
The CacheWriter for the built Configuration. |
protected ExpiryPolicy<? super K,? super V> |
expiryPolicy
The ExpiryPolicy for the Configuration. |
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 Summary | |
|---|---|
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,
CacheLoader<K,? extends V> cacheLoader,
CacheWriter<? super K,? super V> cacheWriter,
ExpiryPolicy<? super K,? super V> expiryPolicy,
boolean isReadThrough,
boolean isWriteThrough,
boolean isStatisticsEnabled,
boolean isStoreByValue,
boolean isTransactionsEnabled,
IsolationLevel txnIsolationLevel,
Mode txnMode)
Constructs a MutableConfiguration based on a set of parameters. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object object)
|
Iterable<CacheEntryListenerRegistration<? super K,? super V>> |
getCacheEntryListenerRegistrations()
Obtains the CacheEntryListenerRegistrations for CacheEntryListeners
to be configured on a Cache. |
CacheLoader<K,? extends V> |
getCacheLoader()
Gets the registered CacheLoader, if any. |
CacheWriter<? super K,? super V> |
getCacheWriter()
Gets the registered CacheWriter, if any. |
ExpiryPolicy<? super K,? super V> |
getExpiryPolicy()
Gets the ExpiryPolicy to be used for caches. |
IsolationLevel |
getTransactionIsolationLevel()
Gets the transaction isolation level. |
Mode |
getTransactionMode()
Gets the transaction mode. |
int |
hashCode()
|
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> |
setCacheLoader(CacheLoader<K,? extends V> loader)
Set the CacheLoader. |
MutableConfiguration<K,V> |
setCacheWriter(CacheWriter<? super K,? super V> writer)
Set the CacheWriter. |
MutableConfiguration<K,V> |
setExpiryPolicy(ExpiryPolicy<? super K,? super V> policy)
Set the ExpiryPolicy. |
MutableConfiguration<K,V> |
setReadThrough(boolean isReadThrough)
Set if read-through caching should be used. |
void |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList<CacheEntryListenerRegistration<? super K,? super V>> cacheEntryListenerRegistrations
CacheEntryListenerRegistrations for the Configuration.
protected CacheLoader<K,? extends V> cacheLoader
CacheLoader for the built Configuration.
protected CacheWriter<? super K,? super V> cacheWriter
CacheWriter for the built Configuration.
protected ExpiryPolicy<? super K,? super V> expiryPolicy
ExpiryPolicy for the Configuration.
protected boolean isReadThrough
protected boolean isWriteThrough
protected boolean isStatisticsEnabled
protected boolean isStoreByValue
protected boolean isTransactionsEnabled
protected IsolationLevel txnIsolationLevel
IsolationLevel.
protected Mode txnMode
Mode.
| Constructor Detail |
|---|
public MutableConfiguration()
MutableConfiguration with the standard
default values.
public MutableConfiguration(Iterable<CacheEntryListenerRegistration<? super K,? super V>> cacheEntryListenerRegistrations,
CacheLoader<K,? extends V> cacheLoader,
CacheWriter<? super K,? super V> cacheWriter,
ExpiryPolicy<? super K,? super V> expiryPolicy,
boolean isReadThrough,
boolean isWriteThrough,
boolean isStatisticsEnabled,
boolean isStoreByValue,
boolean isTransactionsEnabled,
IsolationLevel txnIsolationLevel,
Mode txnMode)
MutableConfiguration based on a set of parameters.
cacheEntryListenerRegistrations - the CacheEntryListenerRegistrationscacheLoader - the CacheLoadercacheWriter - the CacheWriterexpiryPolicy - the ExpiryPolicyisReadThrough - 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 copy| Method Detail |
|---|
public 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 CacheEntryListenerRegistrations
public 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 CacheLoader<K,? extends V> getCacheLoader()
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.
getCacheLoader in interface Configuration<K,V>CacheLoader or null if none has been set.public MutableConfiguration<K,V> setCacheLoader(CacheLoader<K,? extends V> loader)
CacheLoader.
loader - the CacheLoader
MutableConfiguration to permit fluent-style method callspublic CacheWriter<? super K,? super V> getCacheWriter()
CacheWriter, if any.
The default value is null.
getCacheWriter in interface Configuration<K,V>CacheWriter or null if none has been set.public MutableConfiguration<K,V> setCacheWriter(CacheWriter<? super K,? super V> writer)
CacheWriter.
writer - the CacheWriter
MutableConfiguration to permit fluent-style method callspublic ExpiryPolicy<? super K,? super V> getExpiryPolicy()
ExpiryPolicy to be used for caches.
The default value is ExpiryPolicy#DEFAULT.
getExpiryPolicy in interface Configuration<K,V>ExpiryPolicy (must not be null)public MutableConfiguration<K,V> setExpiryPolicy(ExpiryPolicy<? super K,? super V> policy)
ExpiryPolicy. If null is specified
the ExpiryPolicy Default is assumed.
policy - the ExpiryPolicy
MutableConfiguration 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 Mode
MutableConfiguration 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 Mode
MutableConfiguration 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.getCacheLoader()public MutableConfiguration<K,V> setReadThrough(boolean isReadThrough)
isReadThrough - true if read-through is required
MutableConfiguration 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.getCacheWriter()public MutableConfiguration<K,V> setWriteThrough(boolean isWriteThrough)
isWriteThrough - true if write-through is required
MutableConfiguration 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 void setStatisticsEnabled(boolean enabled)
CacheManager.enableStatistics(String, boolean).
enabled - true to enable statistics, false to disable.public boolean isTransactionsEnabled()
false.
isTransactionsEnabled in interface Configuration<K,V>public MutableConfiguration<K,V> setTransactionsEnabled(boolean isTransactionsEnabled)
isTransactionsEnabled - true if transactions should be enabled
MutableConfiguration to permit fluent-style method callspublic int hashCode()
hashCode in class Objectpublic boolean equals(Object object)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||