org.infinispan
Interface AdvancedCache<K,V>

All Superinterfaces:
Cache<K,V>, ConcurrentMap<K,V>, Lifecycle, Listenable, Map<K,V>
All Known Implementing Classes:
AbstractDelegatingAdvancedCache, CacheDelegate

public interface AdvancedCache<K,V>
extends Cache<K,V>

An advanced interface that exposes additional methods not available on Cache.

Since:
4.0
Author:
Manik Surtani

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 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.
 void addInterceptorAfter(CommandInterceptor i, Class<? extends CommandInterceptor> afterInterceptor)
          Adds a custom interceptor to the interceptor chain, after an instance of the specified interceptor type.
 void addInterceptorBefore(CommandInterceptor i, Class<? extends CommandInterceptor> beforeInterceptor)
          Adds a custom interceptor to the interceptor chain, before an instance of the specified interceptor type.
 BatchContainer getBatchContainer()
           
 ComponentRegistry getComponentRegistry()
           
 DataContainer getDataContainer()
           
 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()
           
 RpcManager getRpcManager()
           
 Stats getStats()
           
 TransactionManager getTransactionManager()
           
 boolean lock(Collection<? extends K> keys)
          Locks collections of keys eagerly across cache nodes in a cluster.
 boolean lock(K... keys)
          Locks a given key or keys eagerly across cache nodes in a cluster.
 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.
 AdvancedCache<K,V> withFlags(Flag... flags)
          A builder-style method that adds flags to any API call.
 
Methods inherited from interface org.infinispan.Cache
clearAsync, compact, endBatch, entrySet, evict, getAdvancedCache, getCacheManager, getConfiguration, getName, getStatus, getVersion, keySet, put, put, putAll, putAll, putAllAsync, putAllAsync, putAllAsync, putAsync, putAsync, putAsync, putForExternalRead, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, removeAsync, removeAsync, replace, replace, replace, replace, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, startBatch, values
 
Methods inherited from interface java.util.concurrent.ConcurrentMap
putIfAbsent, remove, replace, replace
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, size
 
Methods inherited from interface org.infinispan.lifecycle.Lifecycle
start, stop
 
Methods inherited from interface org.infinispan.notifications.Listenable
addListener, getListeners, removeListener
 

Method Detail

withFlags

AdvancedCache<K,V> withFlags(Flag... flags)
A builder-style method that adds flags to any API call. For example, consider the following code snippet:
   cache.withFlags(Flag.FORCE_WRITE_LOCK).get(key);
 
will invoke a cache.get() with a write lock forced.

Parameters:
flags - a set of flags to apply. See the Flag documentation.
Returns:
a cache on which a real operation is to be invoked.

addInterceptor

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.

Parameters:
i - the interceptor to add
position - the position to add the interceptor

addInterceptorAfter

void addInterceptorAfter(CommandInterceptor i,
                         Class<? extends CommandInterceptor> afterInterceptor)
Adds a custom interceptor to the interceptor chain, after an instance of the specified interceptor type. Throws a cache exception if it cannot find an interceptor of the specified type.

Parameters:
i - interceptor to add
afterInterceptor - interceptor type after which to place custom interceptor

addInterceptorBefore

void addInterceptorBefore(CommandInterceptor i,
                          Class<? extends CommandInterceptor> beforeInterceptor)
Adds a custom interceptor to the interceptor chain, before an instance of the specified interceptor type. Throws a cache exception if it cannot find an interceptor of the specified type.

Parameters:
i - interceptor to add
beforeInterceptor - interceptor type before which to place custom interceptor

removeInterceptor

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.

Parameters:
position - the position at which to remove an interceptor

removeInterceptor

void removeInterceptor(Class<? extends CommandInterceptor> interceptorType)
Removes the interceptor of specified type.

Parameters:
interceptorType - type of interceptor to remove

getInterceptorChain

List<CommandInterceptor> getInterceptorChain()
Retrieves the current Interceptor chain.

Returns:
an immutable List of CommandInterceptors configured for this cache

getEvictionManager

EvictionManager getEvictionManager()
Returns:
the eviction manager - if one is configured - for this cache instance

getComponentRegistry

ComponentRegistry getComponentRegistry()
Returns:
the component registry for this cache instance

getDistributionManager

DistributionManager getDistributionManager()
Retrieves a reference to the DistributionManager if the cache is configured to use Distribution. Otherwise, returns a null.

Returns:
a DistributionManager, or null.

lock

boolean lock(K... keys)
Locks a given key or keys eagerly across cache nodes in a cluster.

Keys can be locked eagerly in the context of a transaction only

Parameters:
keys - the keys to lock
Returns:
true if the lock acquisition attempt was successful for all keys; false otherwise.

lock

boolean lock(Collection<? extends K> keys)
Locks collections of keys eagerly across cache nodes in a cluster.

Collections of keys can be locked eagerly in the context of a transaction only

Parameters:
keys - collection of keys to lock
Returns:
true if the lock acquisition attempt was successful for all keys; false otherwise.

getRpcManager

RpcManager getRpcManager()

getBatchContainer

BatchContainer getBatchContainer()

getInvocationContextContainer

InvocationContextContainer getInvocationContextContainer()

getDataContainer

DataContainer getDataContainer()

getTransactionManager

TransactionManager getTransactionManager()

getStats

Stats getStats()


Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.