Search in sources :

Example 1 with GetReconfigurationStatusResponseProto

use of org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetReconfigurationStatusResponseProto in project hadoop by apache.

the class ReconfigurationProtocolServerSideUtils method getReconfigurationStatus.

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();
}
Also used : PropertyChange(org.apache.hadoop.conf.ReconfigurationUtil.PropertyChange) Optional(com.google.common.base.Optional) GetReconfigurationStatusResponseProto(org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetReconfigurationStatusResponseProto) Map(java.util.Map) GetReconfigurationStatusConfigChangeProto(org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetReconfigurationStatusConfigChangeProto)

Aggregations

Optional (com.google.common.base.Optional)1 Map (java.util.Map)1 PropertyChange (org.apache.hadoop.conf.ReconfigurationUtil.PropertyChange)1 GetReconfigurationStatusConfigChangeProto (org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetReconfigurationStatusConfigChangeProto)1 GetReconfigurationStatusResponseProto (org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetReconfigurationStatusResponseProto)1