• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ReconfigurationTaskStatus类的典型用法和代码示例

java 2次浏览

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

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

示例1: getReconfigurationStatus

点赞 3

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
public static ReconfigurationTaskStatus getReconfigurationStatus(
    GetReconfigurationStatusResponseProto response) {
  Map<PropertyChange, Optional<String>> statusMap = null;
  long startTime;
  long endTime = 0;

  startTime = response.getStartTime();
  if (response.hasEndTime()) {
    endTime = response.getEndTime();
  }
  if (response.getChangesCount() > 0) {
    statusMap = Maps.newHashMap();
    for (GetReconfigurationStatusConfigChangeProto change : response
        .getChangesList()) {
      PropertyChange pc = new PropertyChange(change.getName(),
          change.getNewValue(), change.getOldValue());
      String errorMessage = null;
      if (change.hasErrorMessage()) {
        errorMessage = change.getErrorMessage();
      }
      statusMap.put(pc, Optional.fromNullable(errorMessage));
    }
  }
  return new ReconfigurationTaskStatus(startTime, endTime, statusMap);
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:26,
代码来源:ReconfigurationProtocolUtils.java

示例2: getReconfigurationStatus

点赞 2

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
@Override
public ReconfigurationTaskStatus getReconfigurationStatus() throws IOException {
  GetReconfigurationStatusResponseProto response;
  Map<PropertyChange, Optional<String>> statusMap = null;
  long startTime;
  long endTime = 0;
  try {
    response = rpcProxy.getReconfigurationStatus(NULL_CONTROLLER,
        VOID_GET_RECONFIG_STATUS);
    startTime = response.getStartTime();
    if (response.hasEndTime()) {
      endTime = response.getEndTime();
    }
    if (response.getChangesCount() > 0) {
      statusMap = Maps.newHashMap();
      for (GetReconfigurationStatusConfigChangeProto change :
          response.getChangesList()) {
        PropertyChange pc = new PropertyChange(
            change.getName(), change.getNewValue(), change.getOldValue());
        String errorMessage = null;
        if (change.hasErrorMessage()) {
          errorMessage = change.getErrorMessage();
        }
        statusMap.put(pc, Optional.fromNullable(errorMessage));
      }
    }
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
  return new ReconfigurationTaskStatus(startTime, endTime, statusMap);
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:32,
代码来源:ClientDatanodeProtocolTranslatorPB.java

示例3: getReconfigurationStatus

点赞 2

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
@Override
public ReconfigurationTaskStatus getReconfigurationStatus()
    throws IOException {
  try {
    return ReconfigurationProtocolUtils.getReconfigurationStatus(
        rpcProxy
        .getReconfigurationStatus(
            NULL_CONTROLLER,
            VOID_GET_RECONFIG_STATUS));
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:14,
代码来源:ReconfigurationProtocolTranslatorPB.java

示例4: getReconfigurationStatus

点赞 2

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
public static GetReconfigurationStatusResponseProto getReconfigurationStatus(
    ReconfigurationTaskStatus status) {
  GetReconfigurationStatusResponseProto.Builder builder =
      GetReconfigurationStatusResponseProto.newBuilder();

  builder.setStartTime(status.getStartTime());
  if (status.stopped()) {
    builder.setEndTime(status.getEndTime());
    assert status.getStatus() != null;
    for (Map.Entry<PropertyChange, Optional<String>> result : status
        .getStatus().entrySet()) {
      GetReconfigurationStatusConfigChangeProto.Builder changeBuilder =
          GetReconfigurationStatusConfigChangeProto.newBuilder();
      PropertyChange change = result.getKey();
      changeBuilder.setName(change.prop);
      changeBuilder.setOldValue(change.oldVal != null ? change.oldVal : "");
      if (change.newVal != null) {
        changeBuilder.setNewValue(change.newVal);
      }
      if (result.getValue().isPresent()) {
        // Get full stack trace.
        changeBuilder.setErrorMessage(result.getValue().get());
      }
      builder.addChanges(changeBuilder);
    }
  }
  return builder.build();
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:29,
代码来源:ReconfigurationProtocolServerSideUtils.java

示例5: getReconfigurationStatus

点赞 2

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
@Override // ClientDatanodeProtocol
public ReconfigurationTaskStatus getReconfigurationStatus() throws IOException {
  checkSuperuserPrivilege();
  return getReconfigurationTaskStatus();
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:6,
代码来源:DataNode.java

示例6: getReconfigurationStatus

点赞 2

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
int getReconfigurationStatus(String nodeType, String address,
    PrintStream out, PrintStream err) throws IOException {
  if ("datanode".equals(nodeType)) {
    ClientDatanodeProtocol dnProxy = getDataNodeProxy(address);
    try {
      ReconfigurationTaskStatus status = dnProxy.getReconfigurationStatus();
      out.print("Reconfiguring status for DataNode[" + address + "]: ");
      if (!status.hasTask()) {
        out.println("no task was found.");
        return 0;
      }
      out.print("started at " + new Date(status.getStartTime()));
      if (!status.stopped()) {
        out.println(" and is still running.");
        return 0;
      }

      out.println(" and finished at " +
          new Date(status.getEndTime()).toString() + ".");
      for (Map.Entry<PropertyChange, Optional<String>> result :
          status.getStatus().entrySet()) {
        if (!result.getValue().isPresent()) {
          out.print("SUCCESS: ");
        } else {
          out.print("FAILED: ");
        }
        out.printf("Change property %s%n\tFrom: \"%s\"%n\tTo: \"%s\"%n",
            result.getKey().prop, result.getKey().oldVal,
            result.getKey().newVal);
        if (result.getValue().isPresent()) {
          out.println("\tError: " + result.getValue().get() + ".");
        }
      }
    } catch (IOException e) {
      err.println("DataNode reloading configuration: " + e + ".");
      return 1;
    }
  } else {
    err.println("Node type " + nodeType + " does not support reconfiguration.");
    return 1;
  }
  return 0;
}
 

开发者ID:naver,
项目名称:hadoop,
代码行数:44,
代码来源:DFSAdmin.java

示例7: getReconfigurationStatus

点赞 2

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
@Override // ClientDatanodeProtocol & ReconfigurationProtocol
public ReconfigurationTaskStatus getReconfigurationStatus() throws IOException {
  checkSuperuserPrivilege();
  return getReconfigurationTaskStatus();
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:6,
代码来源:DataNode.java

示例8: getReconfigurationStatus

点赞 2

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
int getReconfigurationStatus(String nodeType, String address,
    PrintStream out, PrintStream err) throws IOException {
  if ("datanode".equals(nodeType)) {
    ClientDatanodeProtocol dnProxy = getDataNodeProxy(address);
    try {
      ReconfigurationTaskStatus status = dnProxy.getReconfigurationStatus();
      out.print("Reconfiguring status for DataNode[" + address + "]: ");
      if (!status.hasTask()) {
        out.println("no task was found.");
        return 0;
      }
      out.print("started at " + new Date(status.getStartTime()));
      if (!status.stopped()) {
        out.println(" and is still running.");
        return 0;
      }

      out.println(" and finished at " +
          new Date(status.getEndTime()).toString() + ".");
      if (status.getStatus() == null) {
        // Nothing to report.
        return 0;
      }
      for (Map.Entry<PropertyChange, Optional<String>> result :
          status.getStatus().entrySet()) {
        if (!result.getValue().isPresent()) {
          out.printf(
              "SUCCESS: Changed property %s%n\tFrom: \"%s\"%n\tTo: \"%s\"%n",
              result.getKey().prop, result.getKey().oldVal,
              result.getKey().newVal);
        } else {
          final String errorMsg = result.getValue().get();
          out.printf(
                "FAILED: Change property %s%n\tFrom: \"%s\"%n\tTo: \"%s\"%n",
                result.getKey().prop, result.getKey().oldVal,
                result.getKey().newVal);
          out.println("\tError: " + errorMsg + ".");
        }
      }
    } catch (IOException e) {
      err.println("DataNode reloading configuration: " + e + ".");
      return 1;
    }
  } else {
    err.println("Node type " + nodeType +
        " does not support reconfiguration.");
    return 1;
  }
  return 0;
}
 

开发者ID:aliyun-beta,
项目名称:aliyun-oss-hadoop-fs,
代码行数:51,
代码来源:DFSAdmin.java

示例9: getReconfigurationStatus

点赞 2

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
int getReconfigurationStatus(String nodeType, String address,
    PrintStream out, PrintStream err) throws IOException {
  if ("datanode".equals(nodeType)) {
    ClientDatanodeProtocol dnProxy = getDataNodeProxy(address);
    try {
      ReconfigurationTaskStatus status = dnProxy.getReconfigurationStatus();
      out.print("Reconfiguring status for DataNode[" + address + "]: ");
      if (!status.hasTask()) {
        out.println("no task was found.");
        return 0;
      }
      out.print("started at " + new Date(status.getStartTime()));
      if (!status.stopped()) {
        out.println(" and is still running.");
        return 0;
      }

      out.println(" and finished at " +
          new Date(status.getEndTime()).toString() + ".");
      for (Map.Entry<PropertyChange, Optional<String>> result :
          status.getStatus().entrySet()) {
        if (!result.getValue().isPresent()) {
          out.print("SUCCESS: ");
        } else {
          out.print("FAILED: ");
        }
        out.printf("Change property %s\n\tFrom: \"%s\"\n\tTo: \"%s\"\n",
            result.getKey().prop, result.getKey().oldVal,
            result.getKey().newVal);
        if (result.getValue().isPresent()) {
          out.println("\tError: " + result.getValue().get() + ".");
        }
      }
    } catch (IOException e) {
      err.println("DataNode reloading configuration: " + e + ".");
      return 1;
    }
  } else {
    err.println("Node type " + nodeType + " does not support reconfiguration.");
    return 1;
  }
  return 0;
}
 

开发者ID:Nextzero,
项目名称:hadoop-2.6.0-cdh5.4.3,
代码行数:44,
代码来源:DFSAdmin.java

示例10: getReconfigurationStatus

点赞 1

import org.apache.hadoop.conf.ReconfigurationTaskStatus; //导入依赖的package包/类
/**
 * Get the status of the previously issued reconfig task.
 * @see {@link org.apache.hadoop.conf.ReconfigurationTaskStatus}.
 */
ReconfigurationTaskStatus getReconfigurationStatus() throws IOException;
 

开发者ID:naver,
项目名称:hadoop,
代码行数:6,
代码来源:ClientDatanodeProtocol.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)