Java Code Examples for org.apache.hadoop.net.NodeBase#normalize()

The following examples show how to use org.apache.hadoop.net.NodeBase#normalize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TopologyCache.java    From RDFS with Apache License 2.0 6 votes vote down vote up
private Node resolveAndGetNode(String name) {
  List <String> rNameList = dnsToSwitchMapping.resolve(Arrays.asList(new String [] {name}));
  String networkLoc = NodeBase.normalize(rNameList.get(0));
  Node node = null;

  // we depend on clusterMap to get a canonical node object
  // we synchronize this section to guarantee that two concurrent
  // insertions into the clusterMap don't happen (resulting in
  // multiple copies of the same node being created and returned)
  synchronized (clusterMap) {
    while ((node = clusterMap.getNode(networkLoc+"/"+name)) == null) {
      clusterMap.add(new NodeBase(name, networkLoc));
    }
  }

  return node;
}
 
Example 2
Source File: JobTracker.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public Node resolveAndAddToTopology(String name) {
  List <String> tmpList = new ArrayList<String>(1);
  tmpList.add(name);
  List <String> rNameList = dnsToSwitchMapping.resolve(tmpList);
  String rName = rNameList.get(0);
  String networkLoc = NodeBase.normalize(rName);
  return addHostToNodeMapping(name, networkLoc);
}
 
Example 3
Source File: JobTracker.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
public Node resolveAndAddToTopology(String name) {
  List <String> tmpList = new ArrayList<String>(1);
  tmpList.add(name);
  List <String> rNameList = dnsToSwitchMapping.resolve(tmpList);
  String rName = rNameList.get(0);
  String networkLoc = NodeBase.normalize(rName);
  return addHostToNodeMapping(name, networkLoc);
}
 
Example 4
Source File: DatanodeInfo.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/** Sets the network location */
public synchronized void setNetworkLocation(String location) {
  this.location = NodeBase.normalize(location);
}
 
Example 5
Source File: DatanodeInfo.java    From big-c with Apache License 2.0 4 votes vote down vote up
/** Sets the network location */
public synchronized void setNetworkLocation(String location) {
  this.location = NodeBase.normalize(location);
}
 
Example 6
Source File: DatanodeInfo.java    From RDFS with Apache License 2.0 4 votes vote down vote up
/** Sets the rack name */
public synchronized void setNetworkLocation(String location) {
  this.location = NodeBase.normalize(location);
}
 
Example 7
Source File: DatanodeInfo.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
/** Sets the rack name */
public synchronized void setNetworkLocation(String location) {
  this.location = NodeBase.normalize(location);
}