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


Java NameNodeFile.IMAGE属性代码示例

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


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

示例1: GetImageParams

/**
 * @param request the object from which this servlet reads the url contents
 * @param response the object into which this servlet writes the url contents
 * @throws IOException if the request is bad
 */
public GetImageParams(HttpServletRequest request,
                      HttpServletResponse response
                       ) throws IOException {
  @SuppressWarnings("unchecked")
  Map<String, String[]> pmap = request.getParameterMap();
  isGetImage = isGetEdit = fetchLatest = false;

  for (Map.Entry<String, String[]> entry : pmap.entrySet()) {
    String key = entry.getKey();
    String[] val = entry.getValue();
    if (key.equals("getimage")) { 
      isGetImage = true;
      try {
        txId = ServletUtil.parseLongParam(request, TXID_PARAM);
        String imageType = ServletUtil.getParameter(request, IMAGE_FILE_TYPE);
        nnf = imageType == null ? NameNodeFile.IMAGE : NameNodeFile
            .valueOf(imageType);
      } catch (NumberFormatException nfe) {
        if (request.getParameter(TXID_PARAM).equals(LATEST_FSIMAGE_VALUE)) {
          fetchLatest = true;
        } else {
          throw nfe;
        }
      }
    } else if (key.equals("getedit")) { 
      isGetEdit = true;
      startTxId = ServletUtil.parseLongParam(request, START_TXID_PARAM);
      endTxId = ServletUtil.parseLongParam(request, END_TXID_PARAM);
    } else if (key.equals(STORAGEINFO_PARAM)) {
      storageInfoString = val[0];
    }
  }

  int numGets = (isGetImage?1:0) + (isGetEdit?1:0);
  if ((numGets > 1) || (numGets == 0)) {
    throw new IOException("Illegal parameters to TransferFsImage");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:43,代码来源:ImageServlet.java

示例2: PutImageParams

public PutImageParams(HttpServletRequest request,
    HttpServletResponse response, Configuration conf) throws IOException {
  txId = ServletUtil.parseLongParam(request, TXID_PARAM);
  storageInfoString = ServletUtil.getParameter(request, STORAGEINFO_PARAM);
  fileSize = ServletUtil.parseLongParam(request,
      TransferFsImage.FILE_LENGTH);
  String imageType = ServletUtil.getParameter(request, IMAGE_FILE_TYPE);
  nnf = imageType == null ? NameNodeFile.IMAGE : NameNodeFile
      .valueOf(imageType);
  if (fileSize == 0 || txId == -1 || storageInfoString == null
      || storageInfoString.isEmpty()) {
    throw new IOException("Illegal parameters to TransferFsImage");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ImageServlet.java

示例3: GetImageParams

/**
 * @param request the object from which this servlet reads the url contents
 * @param response the object into which this servlet writes the url contents
 * @throws IOException if the request is bad
 */
public GetImageParams(HttpServletRequest request,
                      HttpServletResponse response
                       ) throws IOException {
  @SuppressWarnings("unchecked")
  Map<String, String[]> pmap = request.getParameterMap();
  isGetImage = isGetEdit = fetchLatest = isBootstrapStandby = false;

  for (Map.Entry<String, String[]> entry : pmap.entrySet()) {
    String key = entry.getKey();
    String[] val = entry.getValue();
    if (key.equals("getimage")) { 
      isGetImage = true;
      try {
        txId = ServletUtil.parseLongParam(request, TXID_PARAM);
        String imageType = ServletUtil.getParameter(request, IMAGE_FILE_TYPE);
        nnf = imageType == null ? NameNodeFile.IMAGE : NameNodeFile
            .valueOf(imageType);
        String bootstrapStandby = ServletUtil.getParameter(request,
            IS_BOOTSTRAP_STANDBY);
        isBootstrapStandby = bootstrapStandby != null &&
            Boolean.parseBoolean(bootstrapStandby);
      } catch (NumberFormatException nfe) {
        if (request.getParameter(TXID_PARAM).equals(LATEST_FSIMAGE_VALUE)) {
          fetchLatest = true;
        } else {
          throw nfe;
        }
      }
    } else if (key.equals("getedit")) { 
      isGetEdit = true;
      startTxId = ServletUtil.parseLongParam(request, START_TXID_PARAM);
      endTxId = ServletUtil.parseLongParam(request, END_TXID_PARAM);
    } else if (key.equals(STORAGEINFO_PARAM)) {
      storageInfoString = val[0];
    }
  }

  int numGets = (isGetImage?1:0) + (isGetEdit?1:0);
  if ((numGets > 1) || (numGets == 0)) {
    throw new IOException("Illegal parameters to TransferFsImage");
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:47,代码来源:ImageServlet.java


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