public class DataContainerImpl extends Object implements DataContainer
| Constructor and Description |
|---|
DataContainerImpl() |
| Modifier and Type | Method and Description |
|---|---|
List<NodeData> |
buildNodeData(List<NodeData> list,
NodeSPI node,
boolean mapSafe)
Prepares a list of
NodeData objects for a specified node and all its children. |
Object[] |
createNodes(Fqn fqn)
Traverses the tree to the given Fqn, creating nodes if needed.
|
void |
createRootNode() |
boolean |
evict(Fqn fqn)
Following scenarios define how eviction works.
|
void |
evict(Fqn fqn,
boolean recursive)
Evicts the given node.
|
boolean |
exists(Fqn fqn)
Tests if an Fqn exists and is valid and not deleted.
|
Set<Fqn> |
getInternalFqns()
Returns a Set
|
List<Fqn> |
getNodesForEviction(Fqn fqn,
boolean recursive)
Generates a list of nodes for eviction.
|
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.
|
NodeSPI |
getRoot()
Deprecated.
|
boolean |
hasChildren(Fqn fqn)
Returns true if the Fqn exists, is valid and is not deleted, and the node has children.
|
void |
injectDependencies(NodeFactory nodeFactory,
LockManager lockManager,
BuddyFqnTransformer transformer,
Configuration configuration) |
boolean |
isResident(Fqn fqn) |
NodeSPI |
peek(Fqn fqn)
Finds a node given a fully qualified name, directly off the interceptor chain.
|
NodeSPI |
peek(Fqn fqn,
boolean includeDeletedNodes)
Same as calling peek(fqn, includeDeletedNodes, false).
|
NodeSPI |
peek(Fqn fqn,
boolean includeDeletedNodes,
boolean includeInvalidNodes)
Peeks for a specified node.
|
InternalNode |
peekInternalNode(Fqn fqn,
boolean includeInvalidNodes)
Similar to
DataContainer.peek(Fqn) except that the underlying node is NOT wrapped as a NodeSPI. |
InternalNode[] |
peekInternalNodeAndDirectParent(Fqn fqn,
boolean includeInvalidNodes)
Similar to
DataContainer.peekInternalNode(Fqn, boolean) except that the node AND its *direct* parent are retrieved. |
String |
printDetails()
Prints information about the contents of the nodes in the cache's current
in-memory state.
|
String |
printDetailsAsHtml() |
String |
printLockInfo()
Returns lock information.
|
void |
registerInternalFqn(Fqn fqn)
Adds the specified Fqn to the list of Fqns to be considered "internal".
|
boolean |
removeFromDataStructure(Fqn f,
boolean skipMarkerCheck)
Removes the actual node from the tree data structure.
|
void |
setBuddyFqnTransformer(BuddyFqnTransformer buddyFqnTransformer) |
void |
setDependencies(NodeFactory nodeFactory,
LockManager lockManager) |
void |
setRoot(Object root)
Sets the root node reference to the node passed in.
|
void |
start() |
void |
stop() |
String |
toString() |
String |
toString(boolean details)
Returns a debug string with optional details of contents.
|
public void injectDependencies(NodeFactory nodeFactory, LockManager lockManager, BuddyFqnTransformer transformer, Configuration configuration)
public void setDependencies(NodeFactory nodeFactory, LockManager lockManager)
public void start()
public void createRootNode()
public void stop()
@Deprecated public NodeSPI getRoot()
DataContainergetRoot in interface DataContainerpublic void setRoot(Object root)
setRoot in interface DataContainerroot - nodepublic boolean isResident(Fqn fqn)
isResident in interface DataContainerfqn - fqn to checkpublic void registerInternalFqn(Fqn fqn)
DataContainerregisterInternalFqn in interface DataContainerfqn - fqn to add to listpublic NodeSPI peek(Fqn fqn)
DataContainerpeek in interface DataContainerfqn - Fully qualified name for the corresponding node.public NodeSPI peek(Fqn fqn, boolean includeDeletedNodes)
DataContainerpeek in interface DataContainerfqn - Fqn to findincludeDeletedNodes - if true, deleted nodes are consideredpublic NodeSPI peek(Fqn fqn, boolean includeDeletedNodes, boolean includeInvalidNodes)
DataContainerpeek in interface DataContainerfqn - Fqn of the node to findincludeDeletedNodes - if true, deleted nodes are also consideredincludeInvalidNodes - if true, invalid nodes are also consideredpublic boolean exists(Fqn fqn)
DataContainerexists in interface DataContainerfqn - the fqn representing the node to testpublic boolean hasChildren(Fqn fqn)
DataContainerhasChildren in interface DataContainerfqn - the fqn to testpublic List<NodeData> buildNodeData(List<NodeData> list, NodeSPI node, boolean mapSafe)
DataContainerNodeData objects for a specified node and all its children.buildNodeData in interface DataContainerlist - List of NodeData objects, which will be added to.node - node to recursively add to the listmapSafe - if true, the node's data map reference is passed to the NodeData instance created. Otherwise, the map is copied.public List<Fqn> getNodesForEviction(Fqn fqn, boolean recursive)
DataContainerNode.setResident(boolean).getNodesForEviction in interface DataContainerfqn - the node to consider for evictionrecursive - if recursive, child nodes are also consideredpublic Set<Fqn> getInternalFqns()
DataContainerBuddyManager.BUDDY_BACKUP_SUBTREE if buddy replication is
enabled.getInternalFqns in interface DataContainernull.public String toString(boolean details)
details - if true, details are printedpublic int getNumberOfLocksHeld()
DataContainergetNumberOfLocksHeld in interface DataContainerpublic int getNumberOfNodes()
DataContainergetNumberOfNodes in interface DataContainerpublic String printDetails()
printDetails in interface DataContainerpublic String printDetailsAsHtml()
public String printLockInfo()
public int getNumberOfAttributes(Fqn fqn)
DataContainergetNumberOfAttributes in interface DataContainerpublic int getNumberOfAttributes()
DataContainergetNumberOfAttributes in interface DataContainerpublic boolean removeFromDataStructure(Fqn f, boolean skipMarkerCheck)
DataContainerremoveFromDataStructure in interface DataContainerf - the Fqn of the node to removeskipMarkerCheck - if true, skips checking the boolean NodeSPI.isDeleted() flag and deletes the node anyway.public void evict(Fqn fqn, boolean recursive)
DataContainerevict in interface DataContainerpublic boolean evict(Fqn fqn)
DataContainerFollowing scenarios define how eviction works. 1. If the given node is a leaf then it is entirely removed from the data structure. The node is marked as invalid. 2. If the given node is a leaf then only the data map is cleared. 3. If the given node is the root node then the cildren nodes are evicted. For each child node 1. or 2. applies
evict in interface DataContainerpublic Object[] createNodes(Fqn fqn)
DataContainer
Object[] results = createNode(myFqn);
results[0] // this is a List<NodeSPI> of nodes created in getting to the target node.
results[1] // is a NodeSPI reference to the target node, regardless of whether it was created or just found.
createNodes in interface DataContainerfqn - fqn to findpublic InternalNode peekInternalNode(Fqn fqn, boolean includeInvalidNodes)
DataContainerDataContainer.peek(Fqn) except that the underlying node is NOT wrapped as a NodeSPI.peekInternalNode in interface DataContainerfqn - fqn to peekincludeInvalidNodes - if true, invalid nodes will be considered as well.public InternalNode[] peekInternalNodeAndDirectParent(Fqn fqn, boolean includeInvalidNodes)
DataContainerDataContainer.peekInternalNode(Fqn, boolean) except that the node AND its *direct* parent are retrieved.peekInternalNodeAndDirectParent in interface DataContainerfqn - fqn to findincludeInvalidNodes - if true, invalid nodes are considered.public void setBuddyFqnTransformer(BuddyFqnTransformer buddyFqnTransformer)
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.