org.apache.hadoop.hdfs.server.datanode.DataNode.connectToNN()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.apache.hadoop.hdfs.server.datanode.DataNode.connectToNN()方法的一些代码示例,展示了DataNode.connectToNN()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataNode.connectToNN()方法的具体详情如下:
包路径:org.apache.hadoop.hdfs.server.datanode.DataNode
类名称:DataNode
方法名:connectToNN

DataNode.connectToNN介绍

[英]Connect to the NN. This is separated out for easier testing.
[中]连接到NN。这是分开的,以便于测试。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

private void connectToNNAndHandshake() throws IOException {
 // get NN proxy
 bpNamenode = dn.connectToNN(nnAddr);
 // First phase of the handshake with NN - get the namespace
 // info.
 NamespaceInfo nsInfo = retrieveNamespaceInfo();
 // Verify that this matches the other NN in this HA pair.
 // This also initializes our block pool in the DN if we are
 // the first NN connection for this BP.
 bpos.verifyAndSetNamespaceInfo(this, nsInfo);
 /* set thread name again to include NamespaceInfo when it's available. */
 this.bpThread.setName(formatThreadName("heartbeating", nnAddr));
 // Second phase of the handshake with the NN.
 register(nsInfo);
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

private void connectToNNAndHandshake() throws IOException {
 // get NN proxy
 bpNamenode = dn.connectToNN(nnAddr);
 // First phase of the handshake with NN - get the namespace
 // info.
 NamespaceInfo nsInfo = retrieveNamespaceInfo();
 
 // Verify that this matches the other NN in this HA pair.
 // This also initializes our block pool in the DN if we are
 // the first NN connection for this BP.
 bpos.verifyAndSetNamespaceInfo(nsInfo);
 
 // Second phase of the handshake with the NN.
 register(nsInfo);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

private void connectToNNAndHandshake() throws IOException {
 // get NN proxy
 bpNamenode = dn.connectToNN(nnAddr);
 // First phase of the handshake with NN - get the namespace
 // info.
 NamespaceInfo nsInfo = retrieveNamespaceInfo();
 
 // Verify that this matches the other NN in this HA pair.
 // This also initializes our block pool in the DN if we are
 // the first NN connection for this BP.
 bpos.verifyAndSetNamespaceInfo(nsInfo);
 
 // Second phase of the handshake with the NN.
 register(nsInfo);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

private BPOfferService setupBPOSForNNs(DataNode mockDn,
  DatanodeProtocolClientSideTranslatorPB ... nns) throws IOException {
 // Set up some fake InetAddresses, then override the connectToNN
 // function to return the corresponding proxies.
 final Map<InetSocketAddress, DatanodeProtocolClientSideTranslatorPB> nnMap = Maps.newLinkedHashMap();
 for (int port = 0; port < nns.length; port++) {
  nnMap.put(new InetSocketAddress(port), nns[port]);
  Mockito.doReturn(nns[port]).when(mockDn).connectToNN(
    Mockito.eq(new InetSocketAddress(port)));
 }
 return new BPOfferService(Lists.newArrayList(nnMap.keySet()), mockDn);
}

相关文章

DataNode类方法