当前位置: 首页>>代码示例>>Java>>正文


Java DatanodeID.getIpcAddr方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.protocol.DatanodeID.getIpcAddr方法的典型用法代码示例。如果您正苦于以下问题:Java DatanodeID.getIpcAddr方法的具体用法?Java DatanodeID.getIpcAddr怎么用?Java DatanodeID.getIpcAddr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.protocol.DatanodeID的用法示例。


在下文中一共展示了DatanodeID.getIpcAddr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createInterDataNodeProtocolProxy

import org.apache.hadoop.hdfs.protocol.DatanodeID; //导入方法依赖的package包/类
public static InterDatanodeProtocol createInterDataNodeProtocolProxy(
    DatanodeID datanodeid, final Configuration conf, final int socketTimeout,
    final boolean connectToDnViaHostname) throws IOException {
  final String dnAddr = datanodeid.getIpcAddr(connectToDnViaHostname);
  final InetSocketAddress addr = NetUtils.createSocketAddr(dnAddr);
  if (LOG.isDebugEnabled()) {
    LOG.debug("Connecting to datanode " + dnAddr + " addr=" + addr);
  }
  final UserGroupInformation loginUgi = UserGroupInformation.getLoginUser();
  try {
    return loginUgi
        .doAs(new PrivilegedExceptionAction<InterDatanodeProtocol>() {
          @Override
          public InterDatanodeProtocol run() throws IOException {
            return new InterDatanodeProtocolTranslatorPB(addr, loginUgi,
                conf, NetUtils.getDefaultSocketFactory(conf), socketTimeout);
          }
        });
  } catch (InterruptedException ie) {
    throw new IOException(ie.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:DataNode.java

示例2: createClientDatanodeProtocolProxy

import org.apache.hadoop.hdfs.protocol.DatanodeID; //导入方法依赖的package包/类
static ClientDatanodeProtocolPB createClientDatanodeProtocolProxy(
    DatanodeID datanodeid, Configuration conf, int socketTimeout,
    boolean connectToDnViaHostname, LocatedBlock locatedBlock) throws IOException {
  final String dnAddr = datanodeid.getIpcAddr(connectToDnViaHostname);
  InetSocketAddress addr = NetUtils.createSocketAddr(dnAddr);
  if (LOG.isDebugEnabled()) {
    LOG.debug("Connecting to datanode " + dnAddr + " addr=" + addr);
  }
  
  // Since we're creating a new UserGroupInformation here, we know that no
  // future RPC proxies will be able to re-use the same connection. And
  // usages of this proxy tend to be one-off calls.
  //
  // This is a temporary fix: callers should really achieve this by using
  // RPC.stopProxy() on the resulting object, but this is currently not
  // working in trunk. See the discussion on HDFS-1965.
  Configuration confWithNoIpcIdle = new Configuration(conf);
  confWithNoIpcIdle.setInt(CommonConfigurationKeysPublic
      .IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY, 0);

  UserGroupInformation ticket = UserGroupInformation
      .createRemoteUser(locatedBlock.getBlock().getLocalBlock().toString());
  ticket.addToken(locatedBlock.getBlockToken());
  return createClientDatanodeProtocolProxy(addr, ticket, confWithNoIpcIdle,
      NetUtils.getDefaultSocketFactory(conf), socketTimeout);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:ClientDatanodeProtocolTranslatorPB.java

示例3: ClientDatanodeProtocolTranslatorPB

import org.apache.hadoop.hdfs.protocol.DatanodeID; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param datanodeid Datanode to connect to.
 * @param conf Configuration.
 * @param socketTimeout Socket timeout to use.
 * @param connectToDnViaHostname connect to the Datanode using its hostname
 * @throws IOException
 */
public ClientDatanodeProtocolTranslatorPB(DatanodeID datanodeid,
    Configuration conf, int socketTimeout, boolean connectToDnViaHostname)
    throws IOException {
  final String dnAddr = datanodeid.getIpcAddr(connectToDnViaHostname);
  InetSocketAddress addr = NetUtils.createSocketAddr(dnAddr);
  if (LOG.isDebugEnabled()) {
    LOG.debug("Connecting to datanode " + dnAddr + " addr=" + addr);
  }
  rpcProxy = createClientDatanodeProtocolProxy(addr,
      UserGroupInformation.getCurrentUser(), conf,
      NetUtils.getDefaultSocketFactory(conf), socketTimeout);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:ClientDatanodeProtocolTranslatorPB.java


注:本文中的org.apache.hadoop.hdfs.protocol.DatanodeID.getIpcAddr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。