|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@ThreadSafe public interface CacheSPI<K,V>
A more detailed interface to Cache
, which is used when writing plugins for or extending JBoss Cache. A reference
to this interface should only be obtained when it is passed in to your code, for example when you write an
CommandInterceptor
or CacheLoader
.
Cache
instance to this interface. In future, the implementation may not allow it.
This interface contains overridden method signatures of some methods from Cache
, overridden to ensure return
types of Node
are replaced with NodeSPI
.
NodeSPI
,
Cache
,
CacheLoader
,
org.jboss.cache.interceptors.ChainedInterceptor
Method Summary | ||
---|---|---|
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. |
|
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. |
|
BuddyManager |
getBuddyManager()
Retrieves the current BuddyManager instance associated with the current Cache instance. |
|
CacheLoaderManager |
getCacheLoaderManager()
Retrieves the current CacheCacheLoaderManager instance associated with the current Cache instance. |
|
|
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()
|
|
GlobalTransaction |
getCurrentTransaction()
Returns the transaction associated with the current thread. |
|
GlobalTransaction |
getCurrentTransaction(Transaction tx,
boolean createIfNotExists)
Returns the global transaction for this local transaction. |
|
List<CommandInterceptor> |
getInterceptorChain()
Retrieves the current Interceptor chain. |
|
Set<Fqn> |
getInternalFqns()
Returns a Set |
|
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. |
|
NodeSPI<K,V> |
getNode(Fqn<?> f)
Overrides Cache.getNode(Fqn) to return a NodeSPI instead of a Node . |
|
NodeSPI<K,V> |
getNode(String s)
Overrides Cache.getNode(String) to return a NodeSPI instead of a Node . |
|
Notifier |
getNotifier()
Retrieves the current Notifier instance associated with the current Cache instance. |
|
int |
getNumberOfAttributes()
|
|
int |
getNumberOfLocksHeld()
|
|
int |
getNumberOfNodes()
|
|
RegionManager |
getRegionManager()
Retrieves the current RegionManager instance associated with the current Cache instance. |
|
NodeSPI<K,V> |
getRoot()
Overrides Cache.getRoot() to return a NodeSPI instead of a Node . |
|
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. |
|
GravitateResult |
gravitateData(Fqn<?> fqn,
boolean searchBuddyBackupSubtrees,
InvocationContext ctx)
Used with buddy replication's data gravitation interceptor. |
|
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). |
|
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. |
Methods inherited from interface org.jboss.cache.Cache |
---|
addCacheListener, clearData, clearData, create, destroy, evict, evict, get, get, getCacheListeners, getCacheStatus, getConfiguration, getData, getInvocationContext, getKeys, getKeys, getLocalAddress, getMembers, getRegion, getVersion, move, move, put, put, put, put, putForExternalRead, remove, remove, removeCacheListener, removeNode, removeNode, removeRegion, setInvocationContext, start, stop |
Method Detail |
---|
NodeSPI<K,V> getRoot()
Cache.getRoot()
to return a NodeSPI
instead of a Node
.
getRoot
in interface Cache<K,V>
NodeSPI<K,V> getNode(String s)
Cache.getNode(String)
to return a NodeSPI
instead of a Node
.
getNode
in interface Cache<K,V>
s
- string representation of an Fqn
NodeSPI<K,V> getNode(Fqn<?> f)
Cache.getNode(Fqn)
to return a NodeSPI
instead of a Node
.
getNode
in interface Cache<K,V>
f
- an Fqn
TransactionManager getTransactionManager()
TransactionManager
, if one is configured.
From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
Inject
annotation.
List<CommandInterceptor> getInterceptorChain()
Inject
annotation.
List
of CommandInterceptor
s configured for this cache, or
null
if create()
has not been invoked
and the interceptors thus do not exist.Marshaller getMarshaller()
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.
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.
Marshaller
void addInterceptor(CommandInterceptor i, int position)
i
- the interceptor to addposition
- the position to add the interceptorvoid addInterceptor(CommandInterceptor i, Class<? extends CommandInterceptor> afterInterceptor)
i
- interceptor to addafterInterceptor
- interceptor type after which to place custom interceptorvoid removeInterceptor(int position)
position
- the position at which to remove an interceptorvoid removeInterceptor(Class<? extends CommandInterceptor> interceptorType)
interceptorType
- type of interceptor to removeCacheLoaderManager getCacheLoaderManager()
Inject
annotation.
CacheLoaderManager
if one or more cache loaders are configured, null otherwise.BuddyManager getBuddyManager()
Inject
annotation.
BuddyManager
if buddy replication is enabled, null otherwise.TransactionTable getTransactionTable()
Inject
annotation.
TransactionTable
RPCManager getRPCManager()
Inject
annotation.
RPCManager
configured.StateTransferManager getStateTransferManager()
Inject
annotation.
StateTransferManager
RegionManager getRegionManager()
Inject
annotation.
RegionManager
Notifier getNotifier()
Inject
annotation.
Notifier
, a class
that is responsible for emitting notifications to registered CacheListeners.String getClusterName()
int getNumberOfAttributes()
int getNumberOfNodes()
GlobalTransaction getCurrentTransaction(Transaction tx, boolean createIfNotExists)
tx
- the current transactioncreateIfNotExists
- if true creates a new transaction if none exists
GlobalTransaction getCurrentTransaction()
NodeSPI<K,V> peek(Fqn<?> fqn, boolean includeDeletedNodes)
fqn
- the Fqn to look up.includeDeletedNodes
- if you intend to see nodes marked as deleted within the current tx, set this to true
NodeSPI<K,V> peek(Fqn<?> fqn, boolean includeDeletedNodes, boolean includeInvalidNodes)
Node.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.
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.
GravitateResult gravitateData(Fqn<?> fqn, boolean searchBuddyBackupSubtrees, InvocationContext ctx)
Configuration.useRegionBasedMarshalling
and the Region
pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
fqn
- the fqn to gravitatesearchBuddyBackupSubtrees
- if true, buddy backup subtrees are searched and if false, they are not.ctx
-
Set<Fqn> getInternalFqns()
BuddyManager.BUDDY_BACKUP_SUBTREE
if buddy replication is
enabled.
null
.int getNumberOfLocksHeld()
boolean exists(Fqn<?> fqn)
fqn
- Fqn to peek
boolean exists(String fqn)
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.
<E> Set<E> getChildrenNames(Fqn<E> fqn)
fqn
- The fully qualified name of the node
Set getChildrenNames(String fqn)
getChildrenNames(Fqn)
fqn
- as a string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |