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


Java CorruptFileBlocks类代码示例

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


CorruptFileBlocks类属于org.apache.hadoop.hdfs.protocol包,在下文中一共展示了CorruptFileBlocks类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadNext

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
private void loadNext() throws IOException {
  if (files == null || fileIdx >= files.length) {
    CorruptFileBlocks cfb = dfs.listCorruptFileBlocks(path, cookie);
    files = cfb.getFiles();
    cookie = cfb.getCookie();
    fileIdx = 0;
    callsMade++;
  }

  if (fileIdx >= files.length) {
    // received an empty response
    // there are no more corrupt file blocks
    nextPath = null;
  } else {
    nextPath = string2Path(files[fileIdx]);
    fileIdx++;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:CorruptFileBlockIterator.java

示例2: versionBasedListCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
/** Version based list corrupt file blocks */
private CorruptFileBlocks versionBasedListCorruptFileBlocks(String path,
    String cookie) throws IOException {
  if (namenodeVersion < ClientProtocol.LIST_CORRUPT_FILEBLOCKS_VERSION) {
    LOG.info("NameNode version is " + namenodeVersion +
             " Using older version of getCorruptFiles.");
    if (cookie != null ) {
      return new CorruptFileBlocks(new String[0], "");
    }
    ArrayList<String> str = new ArrayList<String>();
    for (FileStatus stat : namenode.getCorruptFiles()) {
      String filename = stat.getPath().toUri().getPath();
      if (filename.startsWith(path)) {
        str.add(filename);
      }
    }
    return new CorruptFileBlocks(str.toArray(new String[str.size()]), "");
  }
  return namenode.listCorruptFileBlocks(path, cookie);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:21,代码来源:DFSClient.java

示例3: methodBasedListCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
/** Method based listCorruptFileBlocks */
private CorruptFileBlocks methodBasedListCorruptFileBlocks(String path,
    String cookie) throws IOException {
  if (!namenodeProtocolProxy.isMethodSupported("listCorruptFileBlocks",
      String.class, String.class)) {
    LOG.info("NameNode version is " + namenodeVersion +
             " Using older version of getCorruptFiles.");
    if (cookie != null ) {
      return new CorruptFileBlocks(new String[0], "");
    }
    ArrayList<String> str = new ArrayList<String>();
    for (FileStatus stat : namenode.getCorruptFiles()) {
      String filename = stat.getPath().toUri().getPath();
      if (filename.startsWith(path)) {
        str.add(filename);
      }
    }
    return new CorruptFileBlocks(str.toArray(new String[str.size()]), "");
  }
  return namenode.listCorruptFileBlocks(path, cookie);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:22,代码来源:DFSClient.java

示例4: listCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
/**
 * @return a list in which each entry describes a corrupt file/block
 * @throws IOException
 */
public CorruptFileBlocks listCorruptFileBlocks(String path,
                                               String cookie)
      throws IOException {
  checkOpen();
  TraceScope scope = getPathTraceScope("listCorruptFileBlocks", path);
  try {
    return namenode.listCorruptFileBlocks(path, cookie);
  } finally {
    scope.close();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:DFSClient.java

示例5: listCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
@Override // ClientProtocol
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
    throws IOException {
  checkNNStartup();
  String[] cookieTab = new String[] { cookie };
  Collection<FSNamesystem.CorruptFileBlockInfo> fbs =
    namesystem.listCorruptFileBlocks(path, cookieTab);

  String[] files = new String[fbs.size()];
  int i = 0;
  for(FSNamesystem.CorruptFileBlockInfo fb: fbs) {
    files[i++] = fb.path;
  }
  return new CorruptFileBlocks(files, cookieTab[0]);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:NameNodeRpcServer.java

示例6: convert

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
public static CorruptFileBlocks convert(CorruptFileBlocksProto c) {
  if (c == null)
    return null;
  List<String> fileList = c.getFilesList();
  return new CorruptFileBlocks(fileList.toArray(new String[fileList.size()]),
      c.getCookie());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:PBHelper.java

示例7: listCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
@Override
public ListCorruptFileBlocksResponseProto listCorruptFileBlocks(
    RpcController controller, ListCorruptFileBlocksRequestProto req)
    throws ServiceException {
  try {
    CorruptFileBlocks result = server.listCorruptFileBlocks(
        req.getPath(), req.hasCookie() ? req.getCookie(): null);
    return ListCorruptFileBlocksResponseProto.newBuilder()
        .setCorrupt(PBHelper.convert(result))
        .build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java

示例8: listCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
@Override
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
    throws IOException {
  ListCorruptFileBlocksRequestProto.Builder req = 
      ListCorruptFileBlocksRequestProto.newBuilder().setPath(path);   
  if (cookie != null) 
    req.setCookie(cookie);
  try {
    return PBHelper.convert(
        rpcProxy.listCorruptFileBlocks(null, req.build()).getCorrupt());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ClientNamenodeProtocolTranslatorPB.java

示例9: listCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
/**
 * @return a list in which each entry describes a corrupt file/block
 * @throws IOException
 */
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
    throws IOException {
  checkOpen();
  try (TraceScope ignored
           = newPathTraceScope("listCorruptFileBlocks", path)) {
    return namenode.listCorruptFileBlocks(path, cookie);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:13,代码来源:DFSClient.java

示例10: listCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
@Override
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
    throws IOException {
  ListCorruptFileBlocksRequestProto.Builder req =
      ListCorruptFileBlocksRequestProto.newBuilder().setPath(path);
  if (cookie != null)
    req.setCookie(cookie);
  try {
    return PBHelperClient.convert(
        rpcProxy.listCorruptFileBlocks(null, req.build()).getCorrupt());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:ClientNamenodeProtocolTranslatorPB.java

示例11: listCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
@Override
public ListCorruptFileBlocksResponseProto listCorruptFileBlocks(
    RpcController controller, ListCorruptFileBlocksRequestProto req)
    throws ServiceException {
  try {
    CorruptFileBlocks result = server.listCorruptFileBlocks(
        req.getPath(), req.hasCookie() ? req.getCookie(): null);
    return ListCorruptFileBlocksResponseProto.newBuilder()
        .setCorrupt(PBHelperClient.convert(result))
        .build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java

示例12: listCorruptFileBlocks

import org.apache.hadoop.hdfs.protocol.CorruptFileBlocks; //导入依赖的package包/类
@Override
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
    throws IOException {
  try {
    AuthorizationProvider.beginClientOp();
    return server.listCorruptFileBlocks(path, cookie);
  } finally {
    AuthorizationProvider.endClientOp();
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:11,代码来源:AuthorizationProviderProxyClientProtocol.java


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