HADOOP-14957. ReconfigurationTaskStatus is exposing guava Optional in its public api. Contributed by Haibo Chen, Xiao Chen.
This commit is contained in:
parent
075dd45a24
commit
f66ad1fab9
|
@ -19,7 +19,6 @@
|
|||
package org.apache.hadoop.conf;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.hadoop.util.Time;
|
||||
|
@ -31,6 +30,7 @@ import java.io.IOException;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Utility base class for implementing the Reconfigurable interface.
|
||||
|
@ -148,7 +148,7 @@ public abstract class ReconfigurableBase
|
|||
} catch (ReconfigurationException e) {
|
||||
errorMessage = e.getCause().getMessage();
|
||||
}
|
||||
results.put(change, Optional.fromNullable(errorMessage));
|
||||
results.put(change, Optional.ofNullable(errorMessage));
|
||||
}
|
||||
|
||||
synchronized (parent.reconfigLock) {
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
|
||||
package org.apache.hadoop.conf;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
import org.apache.hadoop.conf.ReconfigurationUtil.PropertyChange;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@InterfaceAudience.Public
|
||||
@InterfaceStability.Stable
|
||||
@InterfaceAudience.LimitedPrivate({"HDFS", "Management Tools"})
|
||||
@InterfaceStability.Unstable
|
||||
public class ReconfigurationTaskStatus {
|
||||
long startTime;
|
||||
long endTime;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
package org.apache.hadoop.conf;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.hadoop.test.GenericTestUtils;
|
||||
|
@ -44,6 +43,7 @@ import java.util.Collection;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
package org.apache.hadoop.hdfs.protocolPB;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.hadoop.conf.ReconfigurationTaskStatus;
|
||||
import org.apache.hadoop.conf.ReconfigurationUtil.PropertyChange;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetReconfigurationStatusConfigChangeProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetReconfigurationStatusResponseProto;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ public final class ReconfigurationProtocolUtils {
|
|||
if (change.hasErrorMessage()) {
|
||||
errorMessage = change.getErrorMessage();
|
||||
}
|
||||
statusMap.put(pc, Optional.fromNullable(errorMessage));
|
||||
statusMap.put(pc, Optional.ofNullable(errorMessage));
|
||||
}
|
||||
}
|
||||
return new ReconfigurationTaskStatus(startTime, endTime, statusMap);
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.hadoop.hdfs.protocolPB;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.hadoop.conf.ReconfigurationTaskStatus;
|
||||
import org.apache.hadoop.conf.ReconfigurationUtil.PropertyChange;
|
||||
|
@ -26,8 +27,6 @@ import org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetRe
|
|||
import org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.GetReconfigurationStatusResponseProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.ReconfigurationProtocolProtos.ListReconfigurablePropertiesResponseProto;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
/**
|
||||
* This is a server side utility class that handles
|
||||
* common logic to to parameter reconfiguration.
|
||||
|
|
|
@ -33,11 +33,11 @@ import java.util.HashMap;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
|
Loading…
Reference in New Issue