public abstract class AbstractDelegatingCacheImpl<K,V> extends AbstractDelegatingCache<K,V> implements AdvancedCache<K,V>
AbstractDelegatingAdvancedCache, this adapter can only delegate to a CacheImpl instance.AbstractDelegatingCache,
AbstractDelegatingAdvancedCache| Constructor and Description |
|---|
AbstractDelegatingCacheImpl(AdvancedCache<K,V> cache) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInterceptor(CommandInterceptor i,
int position)
Adds a custom interceptor to the interceptor chain, at specified position, where the first interceptor in the
chain is at position 0 and the last one at NUM_INTERCEPTORS - 1.
|
boolean |
addInterceptorAfter(CommandInterceptor i,
Class<? extends CommandInterceptor> afterInterceptor)
Adds a custom interceptor to the interceptor chain, after an instance of the specified interceptor type.
|
boolean |
addInterceptorBefore(CommandInterceptor i,
Class<? extends CommandInterceptor> beforeInterceptor)
Adds a custom interceptor to the interceptor chain, before an instance of the specified interceptor type.
|
void |
applyDelta(K deltaAwareValueKey,
Delta delta,
Object... locksToAcquire)
Applies the given Delta to the DeltaAware object stored under deltaAwareValueKey if and only if all
locksToAcquire locks are successfully obtained
|
protected void |
clear(EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<Void> |
clearAsync(EnumSet<Flag> flags,
ClassLoader classLoader) |
protected boolean |
containsKey(Object key,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected Set<Map.Entry<K,V>> |
entrySet(EnumSet<Flag> flags,
ClassLoader classLoader) |
protected void |
evict(K key,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
get(Object key,
EnumSet<Flag> flags,
ClassLoader classLoader) |
AdvancedCache<K,V> |
getAdvancedCache() |
protected NotifyingFuture<V> |
getAsync(K key,
EnumSet<Flag> flags,
ClassLoader classLoader) |
BatchContainer |
getBatchContainer()
Returns the component in charge of batching cache operations.
|
ClassLoader |
getClassLoader()
Returns the cache loader associated associated with this cache.
|
ComponentRegistry |
getComponentRegistry() |
DataContainer |
getDataContainer()
Returns the container where data is stored in the cache.
|
DistributionManager |
getDistributionManager()
Retrieves a reference to the
DistributionManager if the cache is configured
to use Distribution. |
EvictionManager |
getEvictionManager() |
List<CommandInterceptor> |
getInterceptorChain()
Retrieves the current Interceptor chain.
|
InvocationContextContainer |
getInvocationContextContainer()
Returns the component in charge of managing the interactions between the
cache operations and the context information associated with them.
|
LockManager |
getLockManager()
Returns the component that deals with all aspects of acquiring and
releasing locks for cache entries.
|
RpcManager |
getRpcManager()
Returns the component in charge of communication with other caches in
the cluster.
|
Stats |
getStats()
Returns a
Stats object that allows several statistics associated
with this cache at runtime. |
TransactionManager |
getTransactionManager()
Returns the transaction manager configured for this cache.
|
XAResource |
getXAResource()
Returns the
XAResource associated with this cache which can be
used to do transactional recovery. |
protected boolean |
isEmpty(EnumSet<Flag> flags,
ClassLoader classLoader) |
protected Set<K> |
keySet(EnumSet<Flag> flags,
ClassLoader classLoader) |
boolean |
lock(Collection<? extends K> keys)
Locks collections of keys eagerly across cache nodes in a cluster.
|
boolean |
lock(K... key)
Locks a given key or keys eagerly across cache nodes in a cluster.
|
protected V |
put(K key,
V value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
put(K key,
V value,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
put(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected void |
putAll(Map<? extends K,? extends V> m,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected void |
putAll(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected void |
putAll(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
putAsync(K key,
V value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected void |
putForExternalRead(K key,
V value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
putIfAbsent(K key,
V value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
putIfAbsent(K key,
V value,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
putIfAbsent(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
remove(Object key,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected boolean |
remove(Object key,
Object value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
removeAsync(Object key,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<Boolean> |
removeAsync(Object key,
Object value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
void |
removeInterceptor(Class<? extends CommandInterceptor> interceptorType)
Removes the interceptor of specified type.
|
void |
removeInterceptor(int position)
Removes the interceptor at a specified position, where the first interceptor in the chain is at position 0 and the
last one at getInterceptorChain().size() - 1.
|
protected V |
replace(K key,
V value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
replace(K key,
V value,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected V |
replace(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected boolean |
replace(K key,
V oldValue,
V newValue,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
replaceAsync(K key,
V value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit unit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected NotifyingFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit,
EnumSet<Flag> flags,
ClassLoader classLoader) |
protected int |
size(EnumSet<Flag> flags,
ClassLoader classLoader) |
protected Collection<V> |
values(EnumSet<Flag> flags,
ClassLoader classLoader) |
AdvancedCache<K,V> |
with(ClassLoader classLoader)
Using this operation, users can call any
AdvancedCache operation
with a given ClassLoader. |
AdvancedCache<K,V> |
withFlags(Flag... flags)
A method that adds flags to any API call.
|
addListener, clear, clearAsync, compact, containsKey, containsValue, endBatch, entrySet, evict, get, getAsync, getCacheConfiguration, getCacheManager, getConfiguration, getListeners, getName, getStatus, getVersion, isEmpty, keySet, put, put, put, putAll, putAll, putAll, putAllAsync, putAllAsync, putAllAsync, putAsync, putAsync, putAsync, putForExternalRead, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, remove, remove, removeAsync, removeAsync, removeListener, replace, replace, replace, replace, replace, replace, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, set, size, start, startBatch, stop, toString, valuesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompact, endBatch, entrySet, evict, getCacheConfiguration, getCacheManager, getConfiguration, getStatus, keySet, putForExternalRead, startBatch, valuesclearAsync, getAsync, getName, getVersion, put, put, putAll, putAll, putAllAsync, putAllAsync, putAllAsync, putAsync, putAsync, putAsync, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, removeAsync, removeAsync, replace, replace, replace, replace, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsyncputIfAbsent, remove, replace, replaceclear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, sizeaddListener, getListeners, removeListenerpublic AbstractDelegatingCacheImpl(AdvancedCache<K,V> cache)
public void addInterceptor(CommandInterceptor i, int position)
AdvancedCacheaddInterceptor in interface AdvancedCache<K,V>i - the interceptor to addposition - the position to add the interceptorpublic boolean addInterceptorAfter(CommandInterceptor i, Class<? extends CommandInterceptor> afterInterceptor)
AdvancedCacheaddInterceptorAfter in interface AdvancedCache<K,V>i - interceptor to addafterInterceptor - interceptor type after which to place custom interceptorpublic boolean addInterceptorBefore(CommandInterceptor i, Class<? extends CommandInterceptor> beforeInterceptor)
AdvancedCacheaddInterceptorBefore in interface AdvancedCache<K,V>i - interceptor to addbeforeInterceptor - interceptor type before which to place custom interceptorpublic void removeInterceptor(int position)
AdvancedCacheremoveInterceptor in interface AdvancedCache<K,V>position - the position at which to remove an interceptorpublic void removeInterceptor(Class<? extends CommandInterceptor> interceptorType)
AdvancedCacheremoveInterceptor in interface AdvancedCache<K,V>interceptorType - type of interceptor to removepublic AdvancedCache<K,V> getAdvancedCache()
getAdvancedCache in interface Cache<K,V>getAdvancedCache in class AbstractDelegatingCache<K,V>public List<CommandInterceptor> getInterceptorChain()
AdvancedCachegetInterceptorChain in interface AdvancedCache<K,V>List of CommandInterceptors
configured for this cachepublic EvictionManager getEvictionManager()
getEvictionManager in interface AdvancedCache<K,V>public ComponentRegistry getComponentRegistry()
getComponentRegistry in interface AdvancedCache<K,V>public DistributionManager getDistributionManager()
AdvancedCacheDistributionManager if the cache is configured
to use Distribution. Otherwise, returns a null.getDistributionManager in interface AdvancedCache<K,V>public RpcManager getRpcManager()
AdvancedCacheConfiguration.CacheMode
is Configuration.CacheMode.LOCAL, this
method will return null.getRpcManager in interface AdvancedCache<K,V>public BatchContainer getBatchContainer()
AdvancedCachegetBatchContainer in interface AdvancedCache<K,V>public InvocationContextContainer getInvocationContextContainer()
AdvancedCachegetInvocationContextContainer in interface AdvancedCache<K,V>public DataContainer getDataContainer()
AdvancedCachegetDataContainer in interface AdvancedCache<K,V>public TransactionManager getTransactionManager()
AdvancedCachegetTransactionManager in interface AdvancedCache<K,V>public LockManager getLockManager()
AdvancedCachegetLockManager in interface AdvancedCache<K,V>public XAResource getXAResource()
AdvancedCacheXAResource associated with this cache which can be
used to do transactional recovery.getXAResource in interface AdvancedCache<K,V>XAResourcepublic AdvancedCache<K,V> withFlags(Flag... flags)
AdvancedCachecache.withFlags(Flag.FORCE_WRITE_LOCK).get(key);will invoke a cache.get() with a write lock forced. Note that for the flag to take effect, the cache operation must be invoked on the instance returned by this method. As an alternative to setting this on every invocation, users could also consider using the
DecoratedCache wrapper, as this allows for more readable
code. E.g.:
Cache forceWriteLockCache = new DecoratedCache(cache, Flag.FORCE_WRITE_LOCK);
forceWriteLockCache.get(key1);
forceWriteLockCache.get(key2);
forceWriteLockCache.get(key3);
withFlags in interface AdvancedCache<K,V>flags - a set of flags to apply. See the Flag documentation.AdvancedCache instance on which a real operation is to be invoked, if the flags are
to be applied.public boolean lock(K... key)
AdvancedCacheKeys can be locked eagerly in the context of a transaction only.
lock in interface AdvancedCache<K,V>key - the keys to lockFlag.FAIL_SILENTLY.public boolean lock(Collection<? extends K> keys)
AdvancedCacheCollections of keys can be locked eagerly in the context of a transaction only.
lock in interface AdvancedCache<K,V>keys - collection of keys to lockFlag.FAIL_SILENTLY.public void applyDelta(K deltaAwareValueKey, Delta delta, Object... locksToAcquire)
AdvancedCacheapplyDelta in interface AdvancedCache<K,V>deltaAwareValueKey - the key for DeltaAware objectdelta - the delta to be applied to DeltaAware objectlocksToAcquire - keys to be locked in DeltaAware scopepublic Stats getStats()
AdvancedCacheStats object that allows several statistics associated
with this cache at runtime.getStats in interface AdvancedCache<K,V>Stats objectpublic ClassLoader getClassLoader()
AdvancedCacheDecoratedCache wrapper.getClassLoader in interface AdvancedCache<K,V>public AdvancedCache<K,V> with(ClassLoader classLoader)
AdvancedCacheAdvancedCache operation
with a given ClassLoader. This means that any ClassLoader happening
as a result of the cache operation will be done using the ClassLoader
given. For example:
When users store POJO instances in caches configured with Configuration.storeAsBinary,
these instances are transformed into byte arrays. When these entries are
read from the cache, a lazy unmarshalling process happens where these byte
arrays are transformed back into POJO instances. Using AdvancedCache.with(ClassLoader)
when reading that enables users to provide the class loader that should
be used when trying to locate the classes that are constructed as a result
of the unmarshalling process.
cache.with(classLoader).get(key);
Note that for the flag to take effect, the cache operation must be invoked on the instance
returned by this method.
As an alternative to setting this on every
invocation, users could also consider using the DecoratedCache wrapper, as this allows for more readable
code. E.g.:
Cache classLoaderSpecificCache = new DecoratedCache(cache, classLoader);
classLoaderSpecificCache.get(key1);
classLoaderSpecificCache.get(key2);
classLoaderSpecificCache.get(key3);
with in interface AdvancedCache<K,V>AdvancedCache instance upon which operations can be called
with a particular ClassLoader.protected final void putForExternalRead(K key, V value, EnumSet<Flag> flags, ClassLoader classLoader)
protected void evict(K key, EnumSet<Flag> flags, ClassLoader classLoader)
protected V put(K key, V value, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected V putIfAbsent(K key, V value, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected V replace(K key, V value, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected V put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected V replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> putAsync(K key, V value, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> putAsync(K key, V value, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<Void> putAllAsync(Map<? extends K,? extends V> data, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<Void> clearAsync(EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> putIfAbsentAsync(K key, V value, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> removeAsync(Object key, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<Boolean> removeAsync(Object key, Object value, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> replaceAsync(K key, V value, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit, EnumSet<Flag> flags, ClassLoader classLoader)
protected int size(EnumSet<Flag> flags, ClassLoader classLoader)
protected boolean isEmpty(EnumSet<Flag> flags, ClassLoader classLoader)
protected boolean containsKey(Object key, EnumSet<Flag> flags, ClassLoader classLoader)
protected V get(Object key, EnumSet<Flag> flags, ClassLoader classLoader)
protected V remove(Object key, EnumSet<Flag> flags, ClassLoader classLoader)
protected void putAll(Map<? extends K,? extends V> m, EnumSet<Flag> flags, ClassLoader classLoader)
protected void clear(EnumSet<Flag> flags, ClassLoader classLoader)
protected Set<K> keySet(EnumSet<Flag> flags, ClassLoader classLoader)
protected Collection<V> values(EnumSet<Flag> flags, ClassLoader classLoader)
protected boolean remove(Object key, Object value, EnumSet<Flag> flags, ClassLoader classLoader)
protected boolean replace(K key, V oldValue, V newValue, EnumSet<Flag> flags, ClassLoader classLoader)
protected NotifyingFuture<V> getAsync(K key, EnumSet<Flag> flags, ClassLoader classLoader)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.