|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.cache.CacheImpl
public class CacheImpl
The default implementation class of Cache
and CacheSPI
. This class
has its roots in the legacy (JBoss Cache 1.x.x) org.jboss.cache.TreeCache class.
Cache
or CacheSPI
interfaces directly to this class.
Cache
Constructor Summary | |
---|---|
protected |
CacheImpl()
Constructs an uninitialized CacheImpl. |
protected |
CacheImpl(Configuration configuration)
Constructs an uninitialized CacheImpl. |
Method Summary | ||
---|---|---|
void |
_addChild(GlobalTransaction gtx,
Fqn parent_fqn,
Object child_name,
Node cn,
boolean undoOps)
Compensating method to _remove(GlobalTransaction,Fqn,boolean) . |
|
void |
_block()
|
|
boolean |
_evict(Fqn fqn)
Internal evict method called by eviction policy provider. |
|
boolean |
_evict(Fqn fqn,
DataVersion version)
Internal evict method called by eviction policy provider. |
|
protected void |
_evictSubtree(Fqn subtree)
Evicts the node at subtree along with all descendant nodes. |
|
Node |
_get(Fqn<?> fqn)
Returns the raw data of the node; called externally internally. |
|
Object |
_get(Fqn<?> fqn,
Object key,
boolean sendNodeEvent)
|
|
Map |
_getData(Fqn<?> fqn)
Returns the raw data of the node; called externally internally. |
|
|
_getChildrenNames(Fqn<E> fqn)
|
|
Set |
_getKeys(Fqn<?> fqn)
|
|
void |
_lock(Fqn fqn,
NodeLock.LockType lock_type,
boolean recursive)
Should not be called. |
|
void |
_move(Fqn nodeToMoveFqn,
Fqn newParentFqn)
Called by reflection |
|
String |
_print(Fqn fqn)
Finds and returns the string value for the Fqn. |
|
void |
_put(GlobalTransaction tx,
Fqn fqn,
Map data,
boolean create_undo_ops)
Internal put method. |
|
void |
_put(GlobalTransaction tx,
Fqn fqn,
Map data,
boolean create_undo_ops,
boolean erase_contents)
Internal put method. |
|
void |
_put(GlobalTransaction tx,
Fqn fqn,
Map data,
boolean create_undo_ops,
boolean erase_contents,
DataVersion dv)
|
|
void |
_put(GlobalTransaction tx,
Fqn fqn,
Map data,
boolean create_undo_ops,
DataVersion dv)
|
|
Object |
_put(GlobalTransaction tx,
Fqn fqn,
Object key,
Object value,
boolean create_undo_ops)
Internal put method. |
|
Object |
_put(GlobalTransaction tx,
Fqn fqn,
Object key,
Object value,
boolean create_undo_ops,
DataVersion dv)
|
|
void |
_put(GlobalTransaction tx,
String fqn,
Map data,
boolean create_undo_ops)
Internal put method. |
|
Object |
_put(GlobalTransaction tx,
String fqn,
Object key,
Object value,
boolean create_undo_ops)
Internal put method. |
|
void |
_putForExternalRead(GlobalTransaction gtx,
Fqn fqn,
Object key,
Object value)
|
|
void |
_putForExternalRead(GlobalTransaction gtx,
Fqn fqn,
Object key,
Object value,
DataVersion dv)
|
|
void |
_releaseAllLocks(Fqn fqn)
Releases all locks for a FQN. |
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops)
Internal remove method. |
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent)
|
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent,
boolean eviction)
Internal method to remove a node. |
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean skipSendingNodeEvents,
boolean eviction,
DataVersion version)
Internal method to remove a node. |
|
boolean |
_remove(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
DataVersion dv)
|
|
Object |
_remove(GlobalTransaction tx,
Fqn fqn,
Object key,
boolean create_undo_ops)
Internal method to remove a key. |
|
Object |
_remove(GlobalTransaction tx,
Fqn fqn,
Object key,
boolean create_undo_ops,
DataVersion dv)
|
|
void |
_remove(GlobalTransaction tx,
String fqn,
boolean create_undo_ops)
Internal remove method. |
|
Object |
_remove(GlobalTransaction tx,
String fqn,
Object key,
boolean create_undo_ops)
Internal method to remove a key. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops)
Internal method to remove data from a node. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent)
Internal method to remove data from a node. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent,
boolean eviction)
Internal method to remove data from a node. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
boolean sendNodeEvent,
boolean eviction,
DataVersion version)
Internal method to remove data from a node. |
|
void |
_removeData(GlobalTransaction tx,
Fqn fqn,
boolean create_undo_ops,
DataVersion dv)
|
|
void |
_removeData(GlobalTransaction tx,
String fqn,
boolean create_undo_ops)
Internal method to remove data from a node. |
|
void |
_unblock()
|
|
void |
addInterceptor(Interceptor i,
Class<? extends Interceptor> afterInterceptor)
|
|
void |
addInterceptor(Interceptor i,
int position)
|
|
void |
addUndoOperation(GlobalTransaction gtx,
MethodCall undo_op)
Adds an undo operatoin to the transaction table. |
|
void |
commit(GlobalTransaction tx)
Throws UnsupportedOperationException. |
|
void |
create()
Lifecycle method. |
|
void |
destroy()
Lifecycle method. |
|
boolean |
exists(Fqn<?> fqn)
Checks whether a given node exists in current in-memory state of the cache. |
|
boolean |
exists(Fqn<?> fqn,
Object key)
Checks whether a given key exists in the given node. |
|
boolean |
exists(String fqn)
Checks whether a given node exists in current in-memory state of the cache. |
|
boolean |
exists(String fqn,
Object key)
|
|
NodeSPI |
findNode(Fqn fqn)
Finds a node given a fully qualified name. |
|
CacheStatus |
getCacheStatus()
|
|
String |
getClusterName()
|
|
protected ComponentRegistry |
getComponentRegistry()
|
|
Configuration |
getConfiguration()
|
|
GlobalTransaction |
getCurrentTransaction()
Returns the transaction associated with the current thread. |
|
GlobalTransaction |
getCurrentTransaction(boolean createIfNotExists)
Returns the transaction associated with the thread; optionally creating it if is does not exist. |
|
GlobalTransaction |
getCurrentTransaction(Transaction tx)
Returns the global transaction for this local transaction. |
|
GlobalTransaction |
getCurrentTransaction(Transaction tx,
boolean createIfNotExists)
Returns the global transaction for this local transaction. |
|
List<Interceptor> |
getInterceptorChain()
|
|
Set<Fqn> |
getInternalFqns()
Returns a Set |
|
protected Transaction |
getLocalTransaction()
Returns the transaction associated with the current thread. |
|
int |
getNumberOfAttributes()
Returns an approximation of the total number of attributes in the cache. |
|
int |
getNumberOfAttributes(Fqn fqn)
Returns an approximation of the total number of attributes in this sub cache. |
|
int |
getNumberOfLocksHeld()
Returns the number of read or write locks held across the entire cache. |
|
int |
getNumberOfNodes()
Returns an approximation of the total number of nodes in the cache. |
|
protected Object |
getOwnerForLock()
Returns an object suitable for use in node locking, either the current transaction or the current thread if there is no transaction. |
|
Region |
getRegion(Fqn<?> fqn,
boolean createIfAbsent)
|
|
NodeSPI |
getRoot()
Returns the root node. |
|
RPCManager |
getRPCManager()
|
|
TransactionManager |
getTransactionManager()
Returns the transaction manager in use. |
|
TransactionTable |
getTransactionTable()
Returns the transaction table. |
|
String |
getVersion()
Returns the CacheImpl implementation version. |
|
GravitateResult |
gravitateData(Fqn fqn,
boolean searchSubtrees)
Used with buddy replication's data gravitation interceptor. |
|
boolean |
hasChild(Fqn fqn)
Returns true if the FQN exists and the node has children. |
|
void |
invalidate(Fqn fqn,
DataVersion versionToInvalidate)
Very much like an evict(), except that regardless of whether there is a child present, this call will never remove the node from memory - just remove its contents. |
|
void |
optimisticPrepare(GlobalTransaction gtx,
List modifications,
Map data,
org.jgroups.Address address,
boolean onePhaseCommit)
Throws UnsupportedOperationException. |
|
NodeSPI |
peek(Fqn<?> fqn,
boolean includeDeletedNodes)
|
|
NodeSPI |
peek(Fqn<?> fqn,
boolean includeDeletedNodes,
boolean includeInvalidNodes)
|
|
void |
prepare(GlobalTransaction global_tx,
List modifications,
org.jgroups.Address coord,
boolean onePhaseCommit)
Throws UnsupportedOperationException. |
|
String |
printDetails()
Prints information about the contents of the nodes in the cache's current in-memory state. |
|
String |
printLockInfo()
Returns lock information. |
|
boolean |
realRemove(Fqn f,
boolean skipMarkerCheck)
Internal method; not to be used externally. |
|
void |
removeInterceptor(Class<? extends Interceptor> interceptorType)
|
|
void |
removeInterceptor(int position)
|
|
boolean |
removeRegion(Fqn<?> fqn)
|
|
void |
rollback(GlobalTransaction tx)
Throws UnsupportedOperationException. |
|
void |
start()
Lifecyle method. |
|
void |
stop()
Lifecycle method. |
|
String |
toString()
Returns a debug string with few details. |
|
String |
toString(boolean details)
Returns a debug string with optional details of contents. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected CacheImpl()
protected CacheImpl(Configuration configuration)
Method Detail |
---|
protected ComponentRegistry getComponentRegistry()
public Configuration getConfiguration()
public String getVersion()
public NodeSPI getRoot()
public TransactionTable getTransactionTable()
public TransactionManager getTransactionManager()
public void create() throws CacheException
Exception
CacheException
public void start() throws CacheException
CacheException
public void destroy()
public void stop()
public CacheStatus getCacheStatus()
public Set<Fqn> getInternalFqns()
BuddyManager.BUDDY_BACKUP_SUBTREE
if buddy replication is
enabled.
null
.protected void _evictSubtree(Fqn subtree) throws CacheException
subtree
along with all descendant nodes.
subtree
- Fqn indicating the uppermost node in the
portion of the cache that should be evicted.
CacheException
public Node _get(Fqn<?> fqn) throws CacheException
CacheException
public Map _getData(Fqn<?> fqn)
public Set _getKeys(Fqn<?> fqn) throws CacheException
CacheException
public Object _get(Fqn<?> fqn, Object key, boolean sendNodeEvent) throws CacheException
CacheException
public boolean exists(String fqn)
fqn
- The fully qualified name of the node
public boolean exists(Fqn<?> fqn)
fqn
- The fully qualified name of the node
public NodeSPI peek(Fqn<?> fqn, boolean includeDeletedNodes)
public NodeSPI peek(Fqn<?> fqn, boolean includeDeletedNodes, boolean includeInvalidNodes)
public boolean exists(String fqn, Object key)
fqn
- key
- public boolean exists(Fqn<?> fqn, Object key)
fqn
- The fully qualified name of the nodekey
-
public <E> Set<E> _getChildrenNames(Fqn<E> fqn) throws CacheException
CacheException
public boolean hasChild(Fqn fqn)
public String toString()
toString
in class Object
public String toString(boolean details)
public String printDetails()
public String printLockInfo()
public int getNumberOfLocksHeld()
public int getNumberOfNodes()
public int getNumberOfAttributes()
public int getNumberOfAttributes(Fqn fqn)
getNumberOfAttributes()
public void _putForExternalRead(GlobalTransaction gtx, Fqn fqn, Object key, Object value, DataVersion dv) throws CacheException
CacheException
public void _put(GlobalTransaction tx, Fqn fqn, Map data, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public void _put(GlobalTransaction tx, Fqn fqn, Map data, boolean create_undo_ops, boolean erase_contents, DataVersion dv) throws CacheException
CacheException
public Object _put(GlobalTransaction tx, Fqn fqn, Object key, Object value, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public Object _remove(GlobalTransaction tx, Fqn fqn, Object key, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, DataVersion dv) throws CacheException
CacheException
public void _put(GlobalTransaction tx, String fqn, Map data, boolean create_undo_ops) throws CacheException
TransactionEntry
's lock list, (b) add nodes
that were created to TransactionEntry
's node list and (c) create
Modification
s and add them to TransactionEntry
's modification
list and (d) create compensating modifications to undo the changes in case
of a rollback
fqn
- data
- create_undo_ops
- If true, undo operations will be created (default is true).
Otherwise they will not be created (used by rollback()).
CacheException
public void _put(GlobalTransaction tx, Fqn fqn, Map data, boolean create_undo_ops) throws CacheException
TransactionEntry
's lock list, (b) add nodes
that were created to TransactionEntry
's node list and (c) create
Modification
s and add them to TransactionEntry
's modification
list and (d) create compensating modifications to undo the changes in case
of a rollback
fqn
- data
- create_undo_ops
- If true, undo operations will be created (default is true).
Otherwise they will not be created (used by rollback()).
CacheException
public void _put(GlobalTransaction tx, Fqn fqn, Map data, boolean create_undo_ops, boolean erase_contents) throws CacheException
TransactionEntry
's lock list, (b) add nodes
that were created to TransactionEntry
's node list and (c) create
Modification
s and add them to TransactionEntry
's modification
list and (d) create compensating modifications to undo the changes in case
of a rollback
fqn
- data
- create_undo_ops
- If true, undo operations will be created (default is true).erase_contents
- Clear the existing hashmap before putting the new data into it
Otherwise they will not be created (used by rollback()).
CacheException
public Object _put(GlobalTransaction tx, String fqn, Object key, Object value, boolean create_undo_ops) throws CacheException
CacheException
public Object _put(GlobalTransaction tx, Fqn fqn, Object key, Object value, boolean create_undo_ops) throws CacheException
CacheException
public void _remove(GlobalTransaction tx, String fqn, boolean create_undo_ops) throws CacheException
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops) throws CacheException
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent) throws CacheException
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction) throws CacheException
tx
- fqn
- create_undo_ops
- sendNodeEvent
-
CacheException
public boolean _remove(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean skipSendingNodeEvents, boolean eviction, DataVersion version) throws CacheException
DataVersion
which is used with optimistically locked nodes. Pass
in a null if optimistic locking is not used.
tx
- fqn
- create_undo_ops
- skipSendingNodeEvents
- eviction
- version
-
CacheException
public Object _remove(GlobalTransaction tx, String fqn, Object key, boolean create_undo_ops) throws CacheException
fqn
- key
-
CacheException
public Object _remove(GlobalTransaction tx, Fqn fqn, Object key, boolean create_undo_ops) throws CacheException
fqn
- key
-
CacheException
public void _removeData(GlobalTransaction tx, String fqn, boolean create_undo_ops) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction) throws CacheException
CacheException
public void _removeData(GlobalTransaction tx, Fqn fqn, boolean create_undo_ops, boolean sendNodeEvent, boolean eviction, DataVersion version) throws CacheException
CacheException
public boolean _evict(Fqn fqn) throws CacheException
fqn
- removes everything assoicated with this FQN
true
if the node has been completely removed,
false
if only the data map was removed, due
to the presence of children
CacheException
public boolean _evict(Fqn fqn, DataVersion version) throws CacheException
fqn
- version
-
true
if the node has been completely removed,
false
if only the data map was removed, due
to the presence of children
CacheException
public void invalidate(Fqn fqn, DataVersion versionToInvalidate)
public void _addChild(GlobalTransaction gtx, Fqn parent_fqn, Object child_name, Node cn, boolean undoOps) throws CacheException
_remove(GlobalTransaction,Fqn,boolean)
.
CacheException
public GravitateResult gravitateData(Fqn fqn, boolean searchSubtrees) throws CacheException
Configuration.useRegionBasedMarshalling
and the Region
pertaining to the Fqn passed in is activated, and has an appropriate ClassLoader.
fqn
- the fqn to gravitatesearchSubtrees
- if true, buddy backup subtrees are searched and if false, they are not.
CacheException
public void _releaseAllLocks(Fqn fqn)
public String _print(Fqn fqn)
public void _lock(Fqn fqn, NodeLock.LockType lock_type, boolean recursive) throws TimeoutException, LockingException
TimeoutException
LockingException
public void optimisticPrepare(GlobalTransaction gtx, List modifications, Map data, org.jgroups.Address address, boolean onePhaseCommit)
public void prepare(GlobalTransaction global_tx, List modifications, org.jgroups.Address coord, boolean onePhaseCommit)
public void commit(GlobalTransaction tx)
public void rollback(GlobalTransaction tx)
public void addUndoOperation(GlobalTransaction gtx, MethodCall undo_op)
public void _move(Fqn nodeToMoveFqn, Fqn newParentFqn)
newParentFqn
- nodeToMoveFqn
- public void _block()
public void _unblock()
protected Transaction getLocalTransaction()
getCurrentTransaction()
public GlobalTransaction getCurrentTransaction()
public GlobalTransaction getCurrentTransaction(boolean createIfNotExists)
public GlobalTransaction getCurrentTransaction(Transaction tx)
public GlobalTransaction getCurrentTransaction(Transaction tx, boolean createIfNotExists)
createIfNotExists
- if true, if a global transaction is not found; one is createdprotected Object getOwnerForLock()
public NodeSPI findNode(Fqn fqn)
TransactionEntry
field.added to the list of locked nodes
in the TransactionEntry
.
This operation will also apply different locking to the cache nodes, depending on operation_type. If it is read type, all nodes will be acquired with read lock. Otherwise, the operation is write type, all parent nodes will be acquired with read lock while the destination node acquires write lock.
fqn
- Fully qualified name for the corresponding node.
public boolean realRemove(Fqn f, boolean skipMarkerCheck)
f
- public List<Interceptor> getInterceptorChain()
public void addInterceptor(Interceptor i, int position)
public void removeInterceptor(int position)
public void removeInterceptor(Class<? extends Interceptor> interceptorType)
public void addInterceptor(Interceptor i, Class<? extends Interceptor> afterInterceptor)
public RPCManager getRPCManager()
public String getClusterName()
public Region getRegion(Fqn<?> fqn, boolean createIfAbsent)
public boolean removeRegion(Fqn<?> fqn)
public void _putForExternalRead(GlobalTransaction gtx, Fqn fqn, Object key, Object value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |