Search in sources :

Example 1 with GetReconfigurationStatusConfigChangeProto

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

the class ReconfigurationProtocolUtils method getReconfigurationStatus.

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

Aggregations

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