HADOOP-15223. Replace Collections.EMPTY* with empty* when available
Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
parent
87bdde6943
commit
4d4dde5112
@ -199,9 +199,8 @@ public String getCipher() {
|
||||
return cipher;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, String> getAttributes() {
|
||||
return (attributes == null) ? Collections.EMPTY_MAP : attributes;
|
||||
return (attributes == null) ? Collections.emptyMap() : attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -370,9 +369,8 @@ public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, String> getAttributes() {
|
||||
return (attributes == null) ? Collections.EMPTY_MAP : attributes;
|
||||
return (attributes == null) ? Collections.emptyMap() : attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public void testInterfaceSuperset() {
|
||||
assertEquals(fsM.stream()
|
||||
.map(MethodSignature::toString)
|
||||
.collect(joining("\n")),
|
||||
Collections.EMPTY_SET, fsM);
|
||||
Collections.emptySet(), fsM);
|
||||
}
|
||||
|
||||
/** Map non-static, declared methods for this class to signatures. */
|
||||
|
@ -28,7 +28,6 @@
|
||||
public class DummyGroupMapping implements GroupMappingServiceProvider {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<String> getGroups(String user) throws IOException {
|
||||
if (user.equals("root")) {
|
||||
return Arrays.asList("admin");
|
||||
@ -37,7 +36,7 @@ else if (user.equals("nobody")) {
|
||||
return Arrays.asList("nobody");
|
||||
} else {
|
||||
String[] groups = HadoopUsersConfTestHelper.getHadoopUserGroups(user);
|
||||
return (groups != null) ? Arrays.asList(groups) : Collections.EMPTY_LIST;
|
||||
return (groups != null) ? Arrays.asList(groups) : Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -723,7 +723,7 @@ static class TombstoneReconcilingIterator implements
|
||||
if (tombstones != null) {
|
||||
this.tombstones = tombstones;
|
||||
} else {
|
||||
this.tombstones = Collections.EMPTY_SET;
|
||||
this.tombstones = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2099,7 +2099,7 @@ S3AFileStatus innerGetFileStatus(final Path f,
|
||||
|
||||
// Check MetadataStore, if any.
|
||||
PathMetadata pm = metadataStore.get(path, needEmptyDirectoryFlag);
|
||||
Set<Path> tombstones = Collections.EMPTY_SET;
|
||||
Set<Path> tombstones = Collections.emptySet();
|
||||
if (pm != null) {
|
||||
if (pm.isDeleted()) {
|
||||
throw new FileNotFoundException("Path " + f + " is recorded as " +
|
||||
|
@ -415,7 +415,7 @@ private static class NullInputFormat extends InputFormat {
|
||||
@Override
|
||||
public List getSplits(JobContext context)
|
||||
throws IOException, InterruptedException {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -144,9 +144,8 @@ public void resetLastNodeHeartBeatResponse() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<UpdatedContainerInfo> pullContainerUpdates() {
|
||||
List<UpdatedContainerInfo> list = Collections.EMPTY_LIST;
|
||||
List<UpdatedContainerInfo> list = Collections.emptyList();
|
||||
if (! pulled) {
|
||||
list = updates;
|
||||
pulled = true;
|
||||
@ -168,11 +167,10 @@ public Set<String> getNodeLabels() {
|
||||
return RMNodeLabelsManager.EMPTY_STRING_SET;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Container> pullNewlyIncreasedContainers() {
|
||||
// TODO Auto-generated method stub
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public OpportunisticContainersStatus getOpportunisticContainersStatus() {
|
||||
|
@ -223,7 +223,7 @@ public abstract void setUpdateRequests(
|
||||
@Public
|
||||
@Unstable
|
||||
public List<SchedulingRequest> getSchedulingRequests() {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -420,7 +420,7 @@ public abstract void setContainersFromPreviousAttempts(
|
||||
@Public
|
||||
@Unstable
|
||||
public List<RejectedSchedulingRequest> getRejectedSchedulingRequests() {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -263,7 +263,7 @@ public void setVersion(int version) {
|
||||
@Private
|
||||
@Unstable
|
||||
public Set<String> getAllocationTags() {
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Private
|
||||
|
@ -368,7 +368,7 @@ public Set<String> getAllcationTags() {
|
||||
if (proto.getAllocationTagsList() != null) {
|
||||
return new HashSet<>(proto.getAllocationTagsList());
|
||||
}
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
// TODO: Needed?
|
||||
|
@ -169,7 +169,7 @@ public void setExecutionType(ExecutionType executionType) { }
|
||||
* Get and set the Allocation tags associated with the container.
|
||||
*/
|
||||
public Set<String> getAllocationTags() {
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
public void setAllocationTags(Set<String> allocationTags) {
|
||||
|
@ -46,7 +46,8 @@ public class ResourcePluginManager {
|
||||
private static final Set<String> SUPPORTED_RESOURCE_PLUGINS = ImmutableSet.of(
|
||||
GPU_URI, FPGA_URI);
|
||||
|
||||
private Map<String, ResourcePlugin> configuredPlugins = Collections.EMPTY_MAP;
|
||||
private Map<String, ResourcePlugin> configuredPlugins =
|
||||
Collections.emptyMap();
|
||||
|
||||
public synchronized void initialize(Context context)
|
||||
throws YarnException {
|
||||
|
@ -207,10 +207,10 @@ public void allocate(ApplicationAttemptId appAttemptId,
|
||||
request.getResourceBlacklistRequest();
|
||||
List<String> blacklistAdditions =
|
||||
(blacklistRequest != null) ?
|
||||
blacklistRequest.getBlacklistAdditions() : Collections.EMPTY_LIST;
|
||||
blacklistRequest.getBlacklistAdditions() : Collections.emptyList();
|
||||
List<String> blacklistRemovals =
|
||||
(blacklistRequest != null) ?
|
||||
blacklistRequest.getBlacklistRemovals() : Collections.EMPTY_LIST;
|
||||
blacklistRequest.getBlacklistRemovals() : Collections.emptyList();
|
||||
RMApp app =
|
||||
getRmContext().getRMApps().get(appAttemptId.getApplicationId());
|
||||
|
||||
|
@ -136,23 +136,21 @@ public enum IntraQueuePreemptionOrderPolicy {
|
||||
private Map<String, PreemptableQueue> preemptableQueues;
|
||||
private Set<ContainerId> killableContainers;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ProportionalCapacityPreemptionPolicy() {
|
||||
clock = SystemClock.getInstance();
|
||||
allPartitions = Collections.EMPTY_SET;
|
||||
leafQueueNames = Collections.EMPTY_SET;
|
||||
preemptableQueues = Collections.EMPTY_MAP;
|
||||
allPartitions = Collections.emptySet();
|
||||
leafQueueNames = Collections.emptySet();
|
||||
preemptableQueues = Collections.emptyMap();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@VisibleForTesting
|
||||
public ProportionalCapacityPreemptionPolicy(RMContext context,
|
||||
CapacityScheduler scheduler, Clock clock) {
|
||||
init(context.getYarnConfiguration(), context, scheduler);
|
||||
this.clock = clock;
|
||||
allPartitions = Collections.EMPTY_SET;
|
||||
leafQueueNames = Collections.EMPTY_SET;
|
||||
preemptableQueues = Collections.EMPTY_MAP;
|
||||
allPartitions = Collections.emptySet();
|
||||
leafQueueNames = Collections.emptySet();
|
||||
preemptableQueues = Collections.emptyMap();
|
||||
}
|
||||
|
||||
public void init(Configuration config, RMContext context,
|
||||
|
@ -2237,7 +2237,7 @@ public Set<String> getBlacklistedNodes() {
|
||||
return attempt.getBlacklistedNodes();
|
||||
}
|
||||
}
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
protected void onInvalidTranstion(RMAppAttemptEventType rmAppAttemptEventType,
|
||||
|
@ -1477,7 +1477,7 @@ public List<Container> pullNewlyIncreasedContainers() {
|
||||
writeLock.lock();
|
||||
|
||||
if (nmReportedIncreasedContainers.isEmpty()) {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
List<Container> container =
|
||||
new ArrayList<Container>(nmReportedIncreasedContainers.values());
|
||||
|
@ -80,10 +80,9 @@ public void setLogAggregationReportsForApps(
|
||||
this.logAggregationReportsForApps = logAggregationReportsForApps;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Container> getNMReportedIncreasedContainers() {
|
||||
return this.nodeStatus.getIncreasedContainers() == null ?
|
||||
Collections.EMPTY_LIST : this.nodeStatus.getIncreasedContainers();
|
||||
Collections.emptyList() : this.nodeStatus.getIncreasedContainers();
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,7 +131,7 @@ public int getPlacementAttempt() {
|
||||
* @return Set of blacklisted Nodes.
|
||||
*/
|
||||
public Set<NodeId> getBlacklist(String tag) {
|
||||
return blacklist.getOrDefault(tag, Collections.EMPTY_SET);
|
||||
return blacklist.getOrDefault(tag, Collections.emptySet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,7 +87,7 @@ public List<PlacedSchedulingRequest> pullPlacedRequests(
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public List<SchedulingRequestWithPlacementAttempt> pullRejectedRequests(
|
||||
@ -104,7 +104,7 @@ public List<SchedulingRequestWithPlacementAttempt> pullRejectedRequests(
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
void clearApplicationState(ApplicationId applicationId) {
|
||||
|
@ -373,9 +373,8 @@ private void validateAndSetSchedulingRequest(SchedulingRequest newSchedulingRequ
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, ResourceRequest> getResourceRequests() {
|
||||
return Collections.EMPTY_MAP;
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -723,13 +723,12 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private NodeStatus getNodeStatusObject(NodeId nodeId) {
|
||||
NodeStatus status = Records.newRecord(NodeStatus.class);
|
||||
status.setNodeId(nodeId);
|
||||
status.setResponseId(0);
|
||||
status.setContainersStatuses(Collections.EMPTY_LIST);
|
||||
status.setKeepAliveApplications(Collections.EMPTY_LIST);
|
||||
status.setContainersStatuses(Collections.emptyList());
|
||||
status.setKeepAliveApplications(Collections.emptyList());
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -781,7 +781,7 @@ private Map<String, String> getOtherConfigurations(String queueExpr) {
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.EMPTY_MAP;
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user