|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.net.NetworkTopology
org.apache.hadoop.net.NetworkTopologyWithNodeGroup
@InterfaceAudience.LimitedPrivate(value={"HDFS","MapReduce"})
@InterfaceStability.Unstable
public class NetworkTopologyWithNodeGroupThe class extends NetworkTopology to represents a cluster of computer with a 4-layers hierarchical network topology. In this network topology, leaves represent data nodes (computers) and inner nodes represent switches/routers that manage traffic in/out of data centers, racks or physical host (with virtual switch).
NetworkTopology| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.hadoop.net.NetworkTopology |
|---|
NetworkTopology.InvalidTopologyException |
| Field Summary | |
|---|---|
static String |
DEFAULT_NODEGROUP
|
| Fields inherited from class org.apache.hadoop.net.NetworkTopology |
|---|
DEFAULT_HOST_LEVEL, DEFAULT_RACK, LOG, netlock, numOfRacks, r |
| Constructor Summary | |
|---|---|
NetworkTopologyWithNodeGroup()
|
|
| Method Summary | |
|---|---|
void |
add(Node node)
Add a leaf node Update node counter & rack counter if necessary |
protected Node |
getNodeForNetworkLocation(Node node)
Return a reference to the node given its string representation. |
String |
getNodeGroup(String loc)
Given a string representation of a node group for a specific network location |
String |
getRack(String loc)
Given a string representation of a rack for a specific network location To be overridden in subclasses for specific NetworkTopology implementations, as alternative to overriding the full NetworkTopology.getRack(String) method. |
boolean |
isNodeGroupAware()
Check if network topology is aware of NodeGroup |
boolean |
isOnSameNodeGroup(Node node1,
Node node2)
Check if two nodes are on the same node group (hypervisor) The assumption here is: each nodes are leaf nodes. |
boolean |
isOnSameRack(Node node1,
Node node2)
Check if two nodes are on the same rack |
void |
pseudoSortByDistance(Node reader,
Node[] nodes)
Sort nodes array by their distances to reader It linearly scans the array, if a local node is found, swap it with the first element of the array. |
void |
remove(Node node)
Remove a node Update node counter and rack counter if necessary |
| Methods inherited from class org.apache.hadoop.net.NetworkTopology |
|---|
chooseRandom, contains, countNumOfAvailableNodes, getDistance, getFirstHalf, getInstance, getLastHalf, getLeaves, getNode, getNumOfLeaves, getNumOfRacks, isSameParents, swap, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_NODEGROUP
| Constructor Detail |
|---|
public NetworkTopologyWithNodeGroup()
| Method Detail |
|---|
protected Node getNodeForNetworkLocation(Node node)
NetworkTopologyNetworkTopology.getNode(String).
To be overridden in subclasses for specific NetworkTopology
implementations, as alternative to overriding the full NetworkTopology.add(Node)
method.
getNodeForNetworkLocation in class NetworkTopologynode - The string representation of this node's network location is
used to retrieve a Node object.
NetworkTopology.add(Node),
NetworkTopology.getNode(String)public String getRack(String loc)
NetworkTopologyNetworkTopology.getRack(String) method.
getRack in class NetworkTopologyloc - a path-like string representation of a network location
public String getNodeGroup(String loc)
loc - a path-like string representation of a network location
public boolean isOnSameRack(Node node1,
Node node2)
NetworkTopology
isOnSameRack in class NetworkTopologynode1 - one nodenode2 - another node
public boolean isOnSameNodeGroup(Node node1,
Node node2)
isOnSameNodeGroup in class NetworkTopologynode1 - one node (can be null)node2 - another node (can be null)
IllegalArgumentException - when either node1 or node2 is null, or node1 or node2 do
not belong to the clusterpublic boolean isNodeGroupAware()
isNodeGroupAware in class NetworkTopologypublic void add(Node node)
add in class NetworkTopologynode - node to be added; can be null
IllegalArgumentException - if add a node to a leave
or node to be added is not a leafpublic void remove(Node node)
remove in class NetworkTopologynode - node to be removed; can be null
public void pseudoSortByDistance(Node reader,
Node[] nodes)
pseudoSortByDistance in class NetworkTopologyreader - the node that wishes to read a block from one of the nodesnodes - the list of nodes containing data for the reader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||