congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Host2NodesMap.getDatanodeByHost
Code IndexAdd Tabnine to your IDE (free)

How to use
getDatanodeByHost
method
in
org.apache.hadoop.hdfs.server.blockmanagement.Host2NodesMap

Best Java code snippets using org.apache.hadoop.hdfs.server.blockmanagement.Host2NodesMap.getDatanodeByHost (Showing top 8 results out of 315)

origin: org.apache.hadoop/hadoop-hdfs

/** @return the datanode descriptor for the host. */
public DatanodeDescriptor getDatanodeByHost(final String host) {
 return host2DatanodeMap.getDatanodeByHost(host);
}
origin: org.apache.hadoop/hadoop-hdfs

/** get a data node by its hostname. This should be used if only one 
 * datanode service is running on a hostname. If multiple datanodes
 * are running on a hostname then use methods getDataNodeByXferAddr and
 * getDataNodeByHostNameAndPort.
 * @return DatanodeDescriptor if found; otherwise null.
 */
DatanodeDescriptor getDataNodeByHostName(String hostname) {
 if(hostname == null) {
  return null;
 }
 
 hostmapLock.readLock().lock();
 try {
  String ipAddr = mapHost.get(hostname);
  if(ipAddr == null) {
   return null;
  } else {  
   return getDatanodeByHost(ipAddr);
  }
 } finally {
  hostmapLock.readLock().unlock();
 }
}
origin: ch.cern.hadoop/hadoop-hdfs

/** @return the datanode descriptor for the host. */
public DatanodeDescriptor getDatanodeByHost(final String host) {
 return host2DatanodeMap.getDatanodeByHost(host);
}
origin: io.prestosql.hadoop/hadoop-apache

/** @return the datanode descriptor for the host. */
public DatanodeDescriptor getDatanodeByHost(final String host) {
 return host2DatanodeMap.getDatanodeByHost(host);
}
origin: ch.cern.hadoop/hadoop-hdfs

/** get a data node by its hostname. This should be used if only one 
 * datanode service is running on a hostname. If multiple datanodes
 * are running on a hostname then use methods getDataNodeByXferAddr and
 * getDataNodeByHostNameAndPort.
 * @return DatanodeDescriptor if found; otherwise null.
 */
DatanodeDescriptor getDataNodeByHostName(String hostname) {
 if(hostname == null) {
  return null;
 }
 
 hostmapLock.readLock().lock();
 try {
  String ipAddr = mapHost.get(hostname);
  if(ipAddr == null) {
   return null;
  } else {  
   return getDatanodeByHost(ipAddr);
  }
 } finally {
  hostmapLock.readLock().unlock();
 }
}
origin: io.prestosql.hadoop/hadoop-apache

/** get a data node by its hostname. This should be used if only one 
 * datanode service is running on a hostname. If multiple datanodes
 * are running on a hostname then use methods getDataNodeByXferAddr and
 * getDataNodeByHostNameAndPort.
 * @return DatanodeDescriptor if found; otherwise null.
 */
DatanodeDescriptor getDataNodeByHostName(String hostname) {
 if(hostname == null) {
  return null;
 }
 
 hostmapLock.readLock().lock();
 try {
  String ipAddr = mapHost.get(hostname);
  if(ipAddr == null) {
   return null;
  } else {  
   return getDatanodeByHost(ipAddr);
  }
 } finally {
  hostmapLock.readLock().unlock();
 }
}
origin: ch.cern.hadoop/hadoop-hdfs

@Test
public void testGetDatanodeByHost() throws Exception {
 assertEquals(map.getDatanodeByHost("1.1.1.1"), dataNodes[0]);
 assertEquals(map.getDatanodeByHost("2.2.2.2"), dataNodes[1]);
 DatanodeDescriptor node = map.getDatanodeByHost("3.3.3.3");
 assertTrue(node == dataNodes[2] || node == dataNodes[3]);
 assertNull(map.getDatanodeByHost("4.4.4.4"));
}
origin: ch.cern.hadoop/hadoop-hdfs

@Test
public void testRemove() throws Exception {
 DatanodeDescriptor nodeNotInMap =
  DFSTestUtil.getDatanodeDescriptor("3.3.3.3", "/d1/r4");
 assertFalse(map.remove(nodeNotInMap));
 
 assertTrue(map.remove(dataNodes[0]));
 assertTrue(map.getDatanodeByHost("1.1.1.1.")==null);
 assertTrue(map.getDatanodeByHost("2.2.2.2")==dataNodes[1]);
 DatanodeDescriptor node = map.getDatanodeByHost("3.3.3.3");
 assertTrue(node==dataNodes[2] || node==dataNodes[3]);
 assertNull(map.getDatanodeByHost("4.4.4.4"));
 
 assertTrue(map.remove(dataNodes[2]));
 assertNull(map.getDatanodeByHost("1.1.1.1"));
 assertEquals(map.getDatanodeByHost("2.2.2.2"), dataNodes[1]);
 assertEquals(map.getDatanodeByHost("3.3.3.3"), dataNodes[3]);
 
 assertTrue(map.remove(dataNodes[3]));
 assertNull(map.getDatanodeByHost("1.1.1.1"));
 assertEquals(map.getDatanodeByHost("2.2.2.2"), dataNodes[1]);
 assertNull(map.getDatanodeByHost("3.3.3.3"));
 
 assertFalse(map.remove(null));
 assertTrue(map.remove(dataNodes[1]));
 assertFalse(map.remove(dataNodes[1]));
}
org.apache.hadoop.hdfs.server.blockmanagementHost2NodesMapgetDatanodeByHost

Javadoc

Get a data node by its IP address.

Popular methods of Host2NodesMap

  • add
    add node to the map return true if the node is added; false otherwise.
  • contains
    Check if node is already in the map.
  • remove
    remove node from the map return true if the node is removed; false otherwise.
  • getDataNodeByHostName
    get a data node by its hostname. This should be used if only one datanode service is running on a ho
  • getDatanodeByXferAddr
    Find data node by its transfer address

Popular in Java

  • Updating database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (Timer)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JTable (javax.swing)
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now