|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.cache.invocation.AbstractInvocationDelegate
org.jboss.cache.invocation.CacheInvocationDelegate<K,V>
public class CacheInvocationDelegate<K,V>
The delegate that users (and ChainedInterceptor authors) interact with when they create a cache by using a cache factory. This wrapper delegates calls down the interceptor chain.
| Field Summary |
|---|
| Fields inherited from class org.jboss.cache.invocation.AbstractInvocationDelegate |
|---|
componentRegistry, configuration, invocationContextContainer, invoker, log, originLocal |
| Constructor Summary | |
|---|---|
CacheInvocationDelegate()
|
|
| Method Summary | ||
|---|---|---|
void |
addCacheListener(Object listener)
Adds a CacheListener-annotated object to the entire cache. |
|
void |
addInterceptor(CommandInterceptor i,
Class<? extends CommandInterceptor> afterInterceptor)
Adds a custom interceptor to the interceptor chain, after an instance of the specified interceptor type. |
|
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 getInterceptorChain().size() - 1. |
|
protected void |
cacheStatusCheck(InvocationContext ctx)
|
|
void |
clearData(Fqn fqn)
Removes the keys and properties from a named node. |
|
void |
clearData(String fqn)
Removes the keys and properties from a node. |
|
void |
create()
Lifecycle method that initializes configuration state, the root node, etc. |
|
void |
destroy()
Lifecycle method that destroys the cache and removes any interceptors/configuration elements. |
|
void |
evict(Fqn<?> fqn)
Eviction call that evicts the specified Node from memory. |
|
void |
evict(Fqn<?> fqn,
boolean recursive)
Eviction call that evicts the specified Node from memory. |
|
boolean |
exists(Fqn<?> fqn)
Helper method that does a peek and ensures that the result of the peek is not null. |
|
boolean |
exists(String fqn)
A convenience method that takes a String representation of an Fqn. |
|
V |
get(Fqn<?> fqn,
K key)
Convenience method that allows for direct access to the data in a Node. |
|
V |
get(String fqn,
K key)
Convenience method that takes a string representation of an Fqn. |
|
BuddyManager |
getBuddyManager()
Retrieves the current BuddyManager instance associated with the current Cache instance. |
|
Set<Object> |
getCacheListeners()
Retrieves an immutable List of objects annotated as CacheListeners attached to the cache. |
|
CacheLoaderManager |
getCacheLoaderManager()
Retrieves the current CacheCacheLoaderManager instance associated with the current Cache instance. |
|
CacheStatus |
getCacheStatus()
Gets where the cache currently is its lifecycle transitions. |
|
|
getChildrenNames(Fqn<E> fqn)
Returns all children of a given node. |
|
Set |
getChildrenNames(String fqn)
Convenience method that takes a String representation of an Fqn. |
|
String |
getClusterName()
|
|
Configuration |
getConfiguration()
Retrieves the configuration of this cache. |
|
GlobalTransaction |
getCurrentTransaction()
Returns the transaction associated with the current thread. |
|
GlobalTransaction |
getCurrentTransaction(Transaction tx,
boolean createIfNotExists)
Returns the global transaction for this local transaction. |
|
Map<K,V> |
getData(Fqn<?> fqn)
Retrieves a defensively copied data map of the underlying node. |
|
DataContainer |
getDataContainer()
|
|
List<CommandInterceptor> |
getInterceptorChain()
Retrieves the current Interceptor chain. |
|
Set<Fqn> |
getInternalFqns()
Returns a Set |
|
InvocationContext |
getInvocationContext()
|
|
Set<K> |
getKeys(Fqn<?> fqn)
Returns a set of attribute keys for the Fqn. |
|
Set |
getKeys(String fqn)
Returns a set of attribute keys for the Fqn. |
|
org.jgroups.Address |
getLocalAddress()
Returns the local address of this cache in a cluster, or null
if running in local mode. |
|
Marshaller |
getMarshaller()
Retrieves an instance of a Marshaller, which is capable of
converting Java objects to bytestreams and back in an efficient manner, which is
also interoperable with bytestreams produced/consumed by other versions of JBoss
Cache. |
|
List<org.jgroups.Address> |
getMembers()
Returns a list of members in the cluster, or null
if running in local mode. |
|
NodeSPI<K,V> |
getNode(Fqn<?> fqn)
A convenience method to retrieve a node directly from the cache. |
|
NodeSPI<K,V> |
getNode(String fqn)
Convenience method that takes a string representation of an Fqn. |
|
Notifier |
getNotifier()
Retrieves the current Notifier instance associated with the current Cache instance. |
|
int |
getNumberOfAttributes()
|
|
int |
getNumberOfLocksHeld()
|
|
int |
getNumberOfNodes()
|
|
Region |
getRegion(Fqn fqn,
boolean createIfAbsent)
Retrieves a Region for a given Fqn. |
|
RegionManager |
getRegionManager()
Retrieves the current RegionManager instance associated with the current Cache instance. |
|
NodeSPI<K,V> |
getRoot()
Returns the root node of this cache. |
|
RPCManager |
getRPCManager()
Gets a handle of the RPC manager. |
|
StateTransferManager |
getStateTransferManager()
Retrieves the current StateTransferManager instance associated with the current Cache instance. |
|
TransactionManager |
getTransactionManager()
Retrieves a reference to a running TransactionManager, if one is configured. |
|
TransactionTable |
getTransactionTable()
Retrieves the current TransactionTable instance associated with the current Cache instance. |
|
String |
getVersion()
Returns the version of the cache as a string. |
|
GravitateResult |
gravitateData(Fqn fqn,
boolean searchBuddyBackupSubtrees,
InvocationContext ctx)
Used with buddy replication's data gravitation interceptor. |
|
void |
initialize(StateTransferManager stateTransferManager,
CacheLoaderManager cacheLoaderManager,
Notifier notifier,
TransactionManager transactionManager,
BuddyManager buddyManager,
TransactionTable transactionTable,
RPCManager rpcManager,
RegionManager regionManager,
Marshaller marshaller,
CommandsFactory commandsFactory,
DataContainer dataContainer)
|
|
void |
move(Fqn<?> nodeToMove,
Fqn<?> newParent)
Moves a part of the cache to a different subtree. |
|
void |
move(String nodeToMove,
String newParent)
Convenience method that takes in string representations of Fqns. |
|
NodeSPI<K,V> |
peek(Fqn fqn,
boolean includeDeletedNodes)
Returns a node without accessing the interceptor chain. |
|
NodeSPI<K,V> |
peek(Fqn fqn,
boolean includeDeletedNodes,
boolean includeInvalidNodes)
Returns a node without accessing the interceptor chain, optionally returning nodes that are marked as invalid ( Node.isValid() == false). |
|
V |
put(Fqn<?> fqn,
K key,
V value)
Associates the specified value with the specified key for a Node in this cache. |
|
void |
put(Fqn<?> fqn,
Map<K,V> data)
Copies all of the mappings from the specified map to a Node. |
|
V |
put(String fqn,
K key,
V value)
Convenience method that takes a string representation of an Fqn. |
|
void |
put(String fqn,
Map<K,V> data)
Convenience method that takes a string representation of an Fqn. |
|
void |
putForExternalRead(Fqn<?> fqn,
K key,
V value)
Under special operating behavior, associates the value with the specified key for a node identified by the Fqn passed in. |
|
V |
remove(Fqn<?> fqn,
K key)
Removes the mapping for this key from a Node. |
|
V |
remove(String fqn,
K key)
Convenience method that takes a string representation of an Fqn. |
|
void |
removeCacheListener(Object listener)
Removes a CacheListener-annotated object from the cache. |
|
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. |
|
boolean |
removeNode(Fqn<?> fqn)
Removes a Node indicated by absolute Fqn. |
|
boolean |
removeNode(String fqn)
Convenience method that takes a string representation of an Fqn. |
|
boolean |
removeRegion(Fqn fqn)
Removes a region denoted by the Fqn passed in. |
|
void |
setInvocationContext(InvocationContext ctx)
Sets the passed in InvocationContext as current. |
|
void |
start()
Lifecycle method that starts the cache loader, starts cache replication, starts the region manager, etc., and (if configured) warms the cache using a state transfer or cache loader preload. |
|
void |
stop()
Lifecycle method that stops the cache, including replication, clustering, cache loading, notifications, etc., and clears all cache in-memory state. |
|
String |
toString()
|
|
| Methods inherited from class org.jboss.cache.invocation.AbstractInvocationDelegate |
|---|
assertIsConstructed, initialize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CacheInvocationDelegate()
| Method Detail |
|---|
public void initialize(StateTransferManager stateTransferManager,
CacheLoaderManager cacheLoaderManager,
Notifier notifier,
TransactionManager transactionManager,
BuddyManager buddyManager,
TransactionTable transactionTable,
RPCManager rpcManager,
RegionManager regionManager,
Marshaller marshaller,
CommandsFactory commandsFactory,
DataContainer dataContainer)
public String toString()
toString in class Objectpublic Configuration getConfiguration()
Cache
getConfiguration in interface Cache<K,V>public NodeSPI<K,V> getRoot()
Cache
getRoot in interface Cache<K,V>getRoot in interface CacheSPI<K,V>public TransactionManager getTransactionManager()
CacheSPITransactionManager, if one is configured.
From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
Inject annotation.
getTransactionManager in interface CacheSPI<K,V>
public void addInterceptor(CommandInterceptor i,
int position)
CacheSPI
addInterceptor in interface CacheSPI<K,V>i - the interceptor to addposition - the position to add the interceptor
public void addInterceptor(CommandInterceptor i,
Class<? extends CommandInterceptor> afterInterceptor)
CacheSPI
addInterceptor in interface CacheSPI<K,V>i - interceptor to addafterInterceptor - interceptor type after which to place custom interceptorpublic List<CommandInterceptor> getInterceptorChain()
CacheSPIInject annotation.
getInterceptorChain in interface CacheSPI<K,V>List of CommandInterceptors configured for this cache, or
null if create() has not been invoked
and the interceptors thus do not exist.public void removeInterceptor(int position)
CacheSPI
removeInterceptor in interface CacheSPI<K,V>position - the position at which to remove an interceptorpublic void removeInterceptor(Class<? extends CommandInterceptor> interceptorType)
CacheSPI
removeInterceptor in interface CacheSPI<K,V>interceptorType - type of interceptor to removepublic CacheLoaderManager getCacheLoaderManager()
CacheSPIInject annotation.
getCacheLoaderManager in interface CacheSPI<K,V>CacheLoaderManager if one or more cache loaders are configured, null otherwise.public BuddyManager getBuddyManager()
CacheSPIInject annotation.
getBuddyManager in interface CacheSPI<K,V>BuddyManager if buddy replication is enabled, null otherwise.public TransactionTable getTransactionTable()
CacheSPIInject annotation.
getTransactionTable in interface CacheSPI<K,V>TransactionTablepublic RPCManager getRPCManager()
CacheSPIInject annotation.
getRPCManager in interface CacheSPI<K,V>RPCManager configured.public StateTransferManager getStateTransferManager()
CacheSPIInject annotation.
getStateTransferManager in interface CacheSPI<K,V>StateTransferManagerpublic String getClusterName()
getClusterName in interface CacheSPI<K,V>public int getNumberOfAttributes()
getNumberOfAttributes in interface CacheSPI<K,V>public int getNumberOfNodes()
getNumberOfNodes in interface CacheSPI<K,V>public RegionManager getRegionManager()
CacheSPIInject annotation.
getRegionManager in interface CacheSPI<K,V>RegionManager
public GlobalTransaction getCurrentTransaction(Transaction tx,
boolean createIfNotExists)
CacheSPI
getCurrentTransaction in interface CacheSPI<K,V>tx - the current transactioncreateIfNotExists - if true creates a new transaction if none exists
public GlobalTransaction getCurrentTransaction()
CacheSPI
getCurrentTransaction in interface CacheSPI<K,V>public Set<Fqn> getInternalFqns()
CacheSPIBuddyManager.BUDDY_BACKUP_SUBTREE if buddy replication is
enabled.
getInternalFqns in interface CacheSPI<K,V>null.public int getNumberOfLocksHeld()
getNumberOfLocksHeld in interface CacheSPI<K,V>public boolean exists(String fqn)
CacheSPICacheSPI.exists(Fqn).
Note that this call works
directly on the cache data structure and will not pass through the interceptor chain. Hence node locking, cache
loading or activation does not take place, and so the results of this call should not be treated as definitive.
exists in interface CacheSPI<K,V>public boolean exists(Fqn<?> fqn)
CacheSPI
exists in interface CacheSPI<K,V>fqn - Fqn to peek
public Notifier getNotifier()
CacheSPIInject annotation.
getNotifier in interface CacheSPI<K,V>Notifier, a class
that is responsible for emitting notifications to registered CacheListeners.public Marshaller getMarshaller()
CacheSPIMarshaller, which is capable of
converting Java objects to bytestreams and back in an efficient manner, which is
also interoperable with bytestreams produced/consumed by other versions of JBoss
Cache.
The use of this marshaller is the recommended way of creating efficient,
compatible, byte streams from objects.
From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
Inject annotation.
getMarshaller in interface CacheSPI<K,V>Marshaller
public GravitateResult gravitateData(Fqn fqn,
boolean searchBuddyBackupSubtrees,
InvocationContext ctx)
CacheSPIConfiguration.useRegionBasedMarshalling and the Region
pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
gravitateData in interface CacheSPI<K,V>fqn - the fqn to gravitatesearchBuddyBackupSubtrees - if true, buddy backup subtrees are searched and if false, they are not.
public NodeSPI<K,V> peek(Fqn fqn,
boolean includeDeletedNodes,
boolean includeInvalidNodes)
CacheSPINode.isValid() == false).
Note that this call works
directly on the cache data structure and will not pass through the interceptor chain. Hence node locking, cache
loading or activation does not take place, and so the results of this call should not be treated as definitive. Concurrent node
removal, passivation, etc. may affect the results of this call.
peek in interface CacheSPI<K,V>fqn - the Fqn to look up.includeDeletedNodes - if you intend to see nodes marked as deleted within the current tx, set this to trueincludeInvalidNodes - if true, nodes marked as being invalid are also returned.
public NodeSPI<K,V> peek(Fqn fqn,
boolean includeDeletedNodes)
CacheSPI
peek in interface CacheSPI<K,V>fqn - the Fqn to look up.includeDeletedNodes - if you intend to see nodes marked as deleted within the current tx, set this to true
public void addCacheListener(Object listener)
CacheCacheListener-annotated object to the entire cache. The object passed in needs to be properly annotated with the
CacheListener annotation otherwise an IncorrectCacheListenerException will be thrown.
addCacheListener in interface Cache<K,V>listener - listener to addpublic void removeCacheListener(Object listener)
CacheCacheListener-annotated object from the cache. The object passed in needs to be properly annotated with the
CacheListener annotation otherwise an IncorrectCacheListenerException will be thrown.
removeCacheListener in interface Cache<K,V>listener - listener to removepublic Set<Object> getCacheListeners()
CacheList of objects annotated as CacheListeners attached to the cache.
getCacheListeners in interface Cache<K,V>List of objects annotated as CacheListeners attached to the cache.
public void create()
throws CacheException
Cache
create in interface Cache<K,V>CacheException - if there are creation problems
public void start()
throws CacheException
Cache
start in interface Cache<K,V>CacheException - if there are startup problemspublic void stop()
Cache
stop in interface Cache<K,V>public void destroy()
CacheCache.create() and Cache.start().
destroy in interface Cache<K,V>public CacheStatus getCacheStatus()
Cache
getCacheStatus in interface Cache<K,V>null.public InvocationContext getInvocationContext()
getInvocationContext in interface Cache<K,V>public void setInvocationContext(InvocationContext ctx)
CacheInvocationContext as current.
setInvocationContext in interface Cache<K,V>ctx - invocation context to usepublic org.jgroups.Address getLocalAddress()
Cachenull
if running in local mode.
getLocalAddress in interface Cache<K,V>null
if running in local mode.public List<org.jgroups.Address> getMembers()
Cachenull
if running in local mode.
getMembers in interface Cache<K,V>List of members in the cluster, or null
if running in local mode.public String getVersion()
Cache
getVersion in interface Cache<K,V>Version.printVersion()
public void move(Fqn<?> nodeToMove,
Fqn<?> newParent)
throws NodeNotExistsException
Cache
/a/b/c
/a/b/d
/a/b/e
Fqn f1 = Fqn.fromString("/a/b/c");
Fqn f2 = Fqn.fromString("/a/b/d");
cache.move(f1, f2);
Will result in:
/a/b/d/c /a/b/eand now
Fqn f3 = Fqn.fromString("/a/b/e");
Fqn f4 = Fqn.fromString("/a");
cache.move(f3, f4);
will result in:
/a/b/d/c /a/eNo-op if the node to be moved is the root node.
move in interface Cache<K,V>nodeToMove - the Fqn of the node to move.newParent - new location under which to attach the node being moved.
NodeNotExistsException - may throw one of these if the target node does not exist or if a different thread has moved this node elsewhere already.
public void move(String nodeToMove,
String newParent)
throws NodeNotExistsException
CacheCache.move(Fqn, Fqn)
move in interface Cache<K,V>NodeNotExistsExceptionpublic boolean removeRegion(Fqn fqn)
Cache
removeRegion in interface Cache<K,V>fqn - of the region to remove
public Region getRegion(Fqn fqn,
boolean createIfAbsent)
CacheRegion for a given Fqn. If the region does not exist,
and
getRegion in interface Cache<K,V>fqn - Fqn that is contained in a region.createIfAbsent - If true, will create a new associated region if not found.
Region
public void evict(Fqn<?> fqn,
boolean recursive)
CacheNode from memory.
evict in interface Cache<K,V>fqn - absolute Fqn to the Node to be evicted.recursive - evicts children as wellpublic void evict(Fqn<?> fqn)
CacheNode from memory. Not recursive.
evict in interface Cache<K,V>fqn - absolute Fqn to the Node to be evicted.
public V get(Fqn<?> fqn,
K key)
CacheNode.
get in interface Cache<K,V>fqn - absolute Fqn to the Node to be accessed.key - key under which value is to be retrieved.
Node denoted by specified Fqn.
public V get(String fqn,
K key)
CacheCache.get(Fqn, Object)
get in interface Cache<K,V>fqn - string representation of the Fqn to retrievekey - key to fetch
public boolean removeNode(Fqn<?> fqn)
CacheNode indicated by absolute Fqn.
removeNode in interface Cache<K,V>fqn - Node to remove
public boolean removeNode(String fqn)
CacheCache.removeNode(Fqn)
removeNode in interface Cache<K,V>fqn - string representation of the Fqn to retrieve
public NodeSPI<K,V> getNode(Fqn<?> fqn)
Cache
getNode in interface Cache<K,V>getNode in interface CacheSPI<K,V>fqn - fqn of the node to retrieve
public NodeSPI<K,V> getNode(String fqn)
CacheCache.getNode(Fqn)
getNode in interface Cache<K,V>getNode in interface CacheSPI<K,V>fqn - string representation of the Fqn to retrieve
public V remove(Fqn<?> fqn,
K key)
throws CacheException
Cachenull if the Node contained no mapping for this key.
remove in interface Cache<K,V>fqn - absolute Fqn to the Node to be accessed.key - key whose mapping is to be removed from the Node
CacheException
public V remove(String fqn,
K key)
CacheCache.remove(Fqn, Object)
remove in interface Cache<K,V>fqn - string representation of the Fqn to retrievekey - key to remove
public void put(Fqn<?> fqn,
Map<K,V> data)
CacheNode.
put in interface Cache<K,V>fqn - absolute Fqn to the Node to copy the data todata - mappings to copy
public void put(String fqn,
Map<K,V> data)
CacheCache.put(Fqn, java.util.Map)
put in interface Cache<K,V>fqn - String representation of the Fqndata - data map to insert
public void putForExternalRead(Fqn<?> fqn,
K key,
V value)
Cache
putForExternalRead in interface Cache<K,V>fqn - absolute Fqn to the Node to be accessed.key - key with which the specified value is to be associated.value - value to be associated with the specified key.
public V put(Fqn<?> fqn,
K key,
V value)
CacheNode in this cache.
If the Node previously contained a mapping for this key, the old value is replaced by the specified value.
put in interface Cache<K,V>fqn - absolute Fqn to the Node to be accessed.key - key with which the specified value is to be associated.value - value to be associated with the specified key.
null if there was no mapping for key.
A null return can also indicate that the Node previously associated null with the specified key, if the implementation supports null values.
public V put(String fqn,
K key,
V value)
CacheCache.put(Fqn, Object, Object)
put in interface Cache<K,V>fqn - String representation of the Fqnkey - key with which the specified value is to be associated.value - value to be associated with the specified key.
null if there was no mapping for key.
A null return can also indicate that the Node previously associated null with the specified key, if the implementation supports null values.public Map<K,V> getData(Fqn<?> fqn)
getData in interface Cache<K,V>fqn -
CacheExceptionpublic Set getKeys(String fqn)
getKeys in interface Cache<K,V>fqn - name of the nodepublic Set<K> getKeys(Fqn<?> fqn)
getKeys in interface Cache<K,V>fqn - name of the node
public void clearData(String fqn)
throws CacheException
clearData in interface Cache<K,V>CacheExceptionpublic void clearData(Fqn fqn)
clearData in interface Cache<K,V>fqn - name of the nodepublic <E> Set<E> getChildrenNames(Fqn<E> fqn)
getChildrenNames in interface CacheSPI<K,V>fqn - The fully qualified name of the node
public Set getChildrenNames(String fqn)
CacheSPICacheSPI.getChildrenNames(Fqn)
getChildrenNames in interface CacheSPI<K,V>fqn - as a string
public DataContainer getDataContainer()
protected void cacheStatusCheck(InvocationContext ctx)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||