|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.cache.SimpleConfiguration<K,V>
K - the type of keys maintained the cacheV - the type of cached valuespublic class SimpleConfiguration<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 | |
|---|---|
SimpleConfiguration()
Constructs an SimpleConfiguration with the standard
default values. |
|
SimpleConfiguration(Configuration<K,V> configuration)
A copy-constructor for a SimpleConfiguration. |
|
SimpleConfiguration(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 SimpleConfiguration 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. |
SimpleConfiguration<K,V> |
registerCacheEntryListener(CacheEntryListener<? super K,? super V> cacheEntryListener,
boolean requireOldValue,
CacheEntryEventFilter<? super K,? super V> cacheEntryEventFilter,
boolean synchronous)
Add a CacheEntryListener. |
SimpleConfiguration<K,V> |
setCacheLoader(CacheLoader<K,? extends V> loader)
Set the CacheLoader. |
SimpleConfiguration<K,V> |
setCacheWriter(CacheWriter<? super K,? super V> writer)
Set the CacheWriter. |
SimpleConfiguration<K,V> |
setExpiryPolicy(ExpiryPolicy<? super K,? super V> policy)
Set the ExpiryPolicy. |
SimpleConfiguration<K,V> |
setReadThrough(boolean isReadThrough)
Set if read-through caching should be used. |
void |
setStatisticsEnabled(boolean isStatisticsEnabled)
Sets whether statistics gathering is enabled on this cache. |
SimpleConfiguration<K,V> |
setStoreByValue(boolean isStoreByValue)
Set if a configured cache should use "store-by-value" or "store-by-reference" semantics. |
SimpleConfiguration<K,V> |
setTransactionMode(Mode mode)
Set the Transaction Mode. |
SimpleConfiguration<K,V> |
setTransactions(IsolationLevel level,
Mode mode)
Set the Transaction IsolationLevel and Mode. |
SimpleConfiguration<K,V> |
setTransactionsEnabled(boolean isTransactionsEnabled)
Set if transactions should be enabled. |
SimpleConfiguration<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 SimpleConfiguration()
SimpleConfiguration with the standard
default values.
public SimpleConfiguration(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)
SimpleConfiguration 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 SimpleConfiguration(Configuration<K,V> configuration)
SimpleConfiguration.
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 SimpleConfiguration<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 SimpleConfiguration<K,V> setCacheLoader(CacheLoader<K,? extends V> loader)
CacheLoader.
loader - the CacheLoader
SimpleConfiguration 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 SimpleConfiguration<K,V> setCacheWriter(CacheWriter<? super K,? super V> writer)
CacheWriter.
writer - the CacheWriter
SimpleConfiguration 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 SimpleConfiguration<K,V> setExpiryPolicy(ExpiryPolicy<? super K,? super V> policy)
ExpiryPolicy. If null is specified
the ExpiryPolicy Default is assumed.
policy - the ExpiryPolicy
SimpleConfiguration to permit fluent-style method callspublic IsolationLevel getTransactionIsolationLevel()
IsolationLevel.NONE.
getTransactionIsolationLevel in interface Configuration<K,V>
public SimpleConfiguration<K,V> setTransactions(IsolationLevel level,
Mode mode)
IsolationLevel and Mode.
level - the IsolationLevelmode - the Mode
SimpleConfiguration to permit fluent-style method callspublic Mode getTransactionMode()
Mode.NONE.
getTransactionMode in interface Configuration<K,V>public SimpleConfiguration<K,V> setTransactionMode(Mode mode)
Mode.
mode - the Mode
SimpleConfiguration 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 SimpleConfiguration<K,V> setReadThrough(boolean isReadThrough)
isReadThrough - true if read-through is required
SimpleConfiguration 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 SimpleConfiguration<K,V> setWriteThrough(boolean isWriteThrough)
isWriteThrough - true if write-through is required
SimpleConfiguration to permit fluent-style method callspublic boolean isStoreByValue()
true.
isStoreByValue in interface Configuration<K,V>public SimpleConfiguration<K,V> setStoreByValue(boolean isStoreByValue)
isStoreByValue - true if "store-by-value" is required,
false for "store-by-reference"
SimpleConfiguration to permit fluent-style method callspublic boolean isStatisticsEnabled()
false.
isStatisticsEnabled in interface Configuration<K,V>public void setStatisticsEnabled(boolean isStatisticsEnabled)
setStatisticsEnabled in interface Configuration<K,V>isStatisticsEnabled - true to enable statistics, false to disable.public boolean isTransactionsEnabled()
false.
isTransactionsEnabled in interface Configuration<K,V>public SimpleConfiguration<K,V> setTransactionsEnabled(boolean isTransactionsEnabled)
isTransactionsEnabled - true if transactions should be enabled
SimpleConfiguration 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 | |||||||||