Fairness.Trees
Class RandomTreeManager
java.lang.Object
Fairness.Trees.TreeManager
Fairness.Trees.RandomTreeManager
public class RandomTreeManager
- extends TreeManager
RandomTreeManager constructs a tree randomly by giving each node a single turn to join a tree.
The manager searches the nodes in the desired stripe tree randomly by visiting nodes in that stripe
tree until it finds an appropriate parent for the joining node.
Method Summary |
int |
getNextNodeId()
Returns the next node ID using the node ID allocation algorithm from this TreeManager. |
java.util.Collection<Node> |
getRootNodes()
After a tree reconstruction, returns the nodes that are the roots of their stripe trees. |
void |
rebuildTree()
A method to completely rebuild the Node tree given all nodes in the system. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RandomTreeManager
public RandomTreeManager()
getRootNodes
public java.util.Collection<Node> getRootNodes()
- After a tree reconstruction, returns the nodes that are the roots of their stripe trees. It
is assumed that the Node is the root of its primary stripe and of no other. That is, Node
getParent( getStripeId() ) should return null.
- Specified by:
getRootNodes
in class TreeManager
- Returns:
- non-null Collection of 0 or more Node.
rebuildTree
public void rebuildTree()
- A method to completely rebuild the Node tree given all nodes in the system.
- Specified by:
rebuildTree
in class TreeManager
getNextNodeId
public int getNextNodeId()
- Returns the next node ID using the node ID allocation algorithm from this TreeManager.
- Specified by:
getNextNodeId
in class TreeManager