Java 类org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.GetReconfigurationStatusResponseProto 实例源码

项目:hadoop    文件:ClientDatanodeProtocolTranslatorPB.java   
@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);
}
项目:hadoop    文件:ClientDatanodeProtocolServerSideTranslatorPB.java   
@Override
public GetReconfigurationStatusResponseProto getReconfigurationStatus(
    RpcController unused, GetReconfigurationStatusRequestProto request)
    throws ServiceException {
  GetReconfigurationStatusResponseProto.Builder builder =
      GetReconfigurationStatusResponseProto.newBuilder();
  try {
    ReconfigurationTaskStatus status = impl.getReconfigurationStatus();
    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);
      }
    }
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return builder.build();
}
项目:big-c    文件:ClientDatanodeProtocolTranslatorPB.java   
@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);
}
项目:big-c    文件:ClientDatanodeProtocolServerSideTranslatorPB.java   
@Override
public GetReconfigurationStatusResponseProto getReconfigurationStatus(
    RpcController unused, GetReconfigurationStatusRequestProto request)
    throws ServiceException {
  GetReconfigurationStatusResponseProto.Builder builder =
      GetReconfigurationStatusResponseProto.newBuilder();
  try {
    ReconfigurationTaskStatus status = impl.getReconfigurationStatus();
    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);
      }
    }
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return builder.build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ClientDatanodeProtocolTranslatorPB.java   
@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);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ClientDatanodeProtocolServerSideTranslatorPB.java   
@Override
public GetReconfigurationStatusResponseProto getReconfigurationStatus(
    RpcController unused, GetReconfigurationStatusRequestProto request)
    throws ServiceException {
  GetReconfigurationStatusResponseProto.Builder builder =
      GetReconfigurationStatusResponseProto.newBuilder();
  try {
    ReconfigurationTaskStatus status = impl.getReconfigurationStatus();
    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);
      }
    }
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return builder.build();
}
项目:FlexMap    文件:ClientDatanodeProtocolTranslatorPB.java   
@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);
}
项目:FlexMap    文件:ClientDatanodeProtocolServerSideTranslatorPB.java   
@Override
public GetReconfigurationStatusResponseProto getReconfigurationStatus(
    RpcController unused, GetReconfigurationStatusRequestProto request)
    throws ServiceException {
  GetReconfigurationStatusResponseProto.Builder builder =
      GetReconfigurationStatusResponseProto.newBuilder();
  try {
    ReconfigurationTaskStatus status = impl.getReconfigurationStatus();
    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);
      }
    }
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return builder.build();
}