From 4d4dde5112e9ee6b37cbdea17104c5a4c6870bd5 Mon Sep 17 00:00:00 2001 From: fang zhenyi Date: Sun, 18 Feb 2018 22:19:23 +0900 Subject: [PATCH] HADOOP-15223. Replace Collections.EMPTY* with empty* when available Signed-off-by: Akira Ajisaka --- .../org/apache/hadoop/crypto/key/KeyProvider.java | 6 ++---- .../hdfs/protocol/TestHdfsFileStatusMethods.java | 2 +- .../lib/service/security/DummyGroupMapping.java | 3 +-- .../java/org/apache/hadoop/fs/s3a/Listing.java | 2 +- .../org/apache/hadoop/fs/s3a/S3AFileSystem.java | 2 +- .../hadoop/tools/mapred/TestCopyCommitter.java | 2 +- .../hadoop/yarn/sls/scheduler/RMNodeWrapper.java | 6 ++---- .../yarn/api/protocolrecords/AllocateRequest.java | 2 +- .../yarn/api/protocolrecords/AllocateResponse.java | 2 +- .../apache/hadoop/yarn/api/records/Container.java | 2 +- .../yarn/security/ContainerTokenIdentifier.java | 2 +- .../api/protocolrecords/NMContainerStatus.java | 2 +- .../resourceplugin/ResourcePluginManager.java | 3 ++- .../resourcemanager/DefaultAMSProcessor.java | 4 ++-- .../ProportionalCapacityPreemptionPolicy.java | 14 ++++++-------- .../rmapp/attempt/RMAppAttemptImpl.java | 2 +- .../server/resourcemanager/rmnode/RMNodeImpl.java | 2 +- .../resourcemanager/rmnode/RMNodeStatusEvent.java | 3 +-- .../constraint/processor/BatchedRequests.java | 2 +- .../constraint/processor/PlacementDispatcher.java | 4 ++-- .../SingleConstraintAppPlacementAllocator.java | 3 +-- .../TestResourceTrackerService.java | 5 ++--- ...ionalCapacityPreemptionPolicyMockFramework.java | 2 +- 23 files changed, 34 insertions(+), 43 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java index c1c371b6a4..62cc3818eb 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java @@ -199,9 +199,8 @@ public String getCipher() { return cipher; } - @SuppressWarnings("unchecked") public Map 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 getAttributes() { - return (attributes == null) ? Collections.EMPTY_MAP : attributes; + return (attributes == null) ? Collections.emptyMap() : attributes; } @Override diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestHdfsFileStatusMethods.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestHdfsFileStatusMethods.java index 3cc419083e..683a1baae0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestHdfsFileStatusMethods.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestHdfsFileStatusMethods.java @@ -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. */ diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java index 167690902a..9ef786db2d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java @@ -28,7 +28,6 @@ public class DummyGroupMapping implements GroupMappingServiceProvider { @Override - @SuppressWarnings("unchecked") public List 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(); } } diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java index 11b2e472d6..b016eadcfb 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java @@ -723,7 +723,7 @@ static class TombstoneReconcilingIterator implements if (tombstones != null) { this.tombstones = tombstones; } else { - this.tombstones = Collections.EMPTY_SET; + this.tombstones = Collections.emptySet(); } } diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java index 53875badf9..99901ba3b0 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java @@ -2099,7 +2099,7 @@ S3AFileStatus innerGetFileStatus(final Path f, // Check MetadataStore, if any. PathMetadata pm = metadataStore.get(path, needEmptyDirectoryFlag); - Set tombstones = Collections.EMPTY_SET; + Set tombstones = Collections.emptySet(); if (pm != null) { if (pm.isDeleted()) { throw new FileNotFoundException("Path " + f + " is recorded as " + diff --git a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java index 6ee37ccd6a..bf151cd173 100644 --- a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java +++ b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java @@ -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 diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/RMNodeWrapper.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/RMNodeWrapper.java index 92f9b0fbeb..78645e98d6 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/RMNodeWrapper.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/RMNodeWrapper.java @@ -144,9 +144,8 @@ public void resetLastNodeHeartBeatResponse() { } @Override - @SuppressWarnings("unchecked") public List pullContainerUpdates() { - List list = Collections.EMPTY_LIST; + List list = Collections.emptyList(); if (! pulled) { list = updates; pulled = true; @@ -168,11 +167,10 @@ public Set getNodeLabels() { return RMNodeLabelsManager.EMPTY_STRING_SET; } - @SuppressWarnings("unchecked") @Override public List pullNewlyIncreasedContainers() { // TODO Auto-generated method stub - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public OpportunisticContainersStatus getOpportunisticContainersStatus() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java index 876957e8a8..eee50e3c1e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java @@ -223,7 +223,7 @@ public abstract void setUpdateRequests( @Public @Unstable public List getSchedulingRequests() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java index 52c30e2c4a..3b9c30ff11 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java @@ -420,7 +420,7 @@ public abstract void setContainersFromPreviousAttempts( @Public @Unstable public List getRejectedSchedulingRequests() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java index b9ca3f9096..2dc6e1ff38 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java @@ -263,7 +263,7 @@ public void setVersion(int version) { @Private @Unstable public Set getAllocationTags() { - return Collections.EMPTY_SET; + return Collections.emptySet(); } @Private diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java index 70935cbd88..c5a649d52a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java @@ -368,7 +368,7 @@ public Set getAllcationTags() { if (proto.getAllocationTagsList() != null) { return new HashSet<>(proto.getAllocationTagsList()); } - return Collections.EMPTY_SET; + return Collections.emptySet(); } // TODO: Needed? diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/NMContainerStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/NMContainerStatus.java index 77b3df6a1d..065918d5eb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/NMContainerStatus.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/NMContainerStatus.java @@ -169,7 +169,7 @@ public void setExecutionType(ExecutionType executionType) { } * Get and set the Allocation tags associated with the container. */ public Set getAllocationTags() { - return Collections.EMPTY_SET; + return Collections.emptySet(); } public void setAllocationTags(Set allocationTags) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/ResourcePluginManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/ResourcePluginManager.java index 12d679bb28..f28aad206a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/ResourcePluginManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/ResourcePluginManager.java @@ -46,7 +46,8 @@ public class ResourcePluginManager { private static final Set SUPPORTED_RESOURCE_PLUGINS = ImmutableSet.of( GPU_URI, FPGA_URI); - private Map configuredPlugins = Collections.EMPTY_MAP; + private Map configuredPlugins = + Collections.emptyMap(); public synchronized void initialize(Context context) throws YarnException { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java index 18ab473d3c..71558a76be 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java @@ -207,10 +207,10 @@ public void allocate(ApplicationAttemptId appAttemptId, request.getResourceBlacklistRequest(); List blacklistAdditions = (blacklistRequest != null) ? - blacklistRequest.getBlacklistAdditions() : Collections.EMPTY_LIST; + blacklistRequest.getBlacklistAdditions() : Collections.emptyList(); List blacklistRemovals = (blacklistRequest != null) ? - blacklistRequest.getBlacklistRemovals() : Collections.EMPTY_LIST; + blacklistRequest.getBlacklistRemovals() : Collections.emptyList(); RMApp app = getRmContext().getRMApps().get(appAttemptId.getApplicationId()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java index 304d204c94..3f9fd17168 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java @@ -136,23 +136,21 @@ public enum IntraQueuePreemptionOrderPolicy { private Map preemptableQueues; private Set 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, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java index 8c2f4e40f9..c23b135a3d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java @@ -2237,7 +2237,7 @@ public Set getBlacklistedNodes() { return attempt.getBlacklistedNodes(); } } - return Collections.EMPTY_SET; + return Collections.emptySet(); } protected void onInvalidTranstion(RMAppAttemptEventType rmAppAttemptEventType, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java index 4fc2d8a4a8..3cbde01abe 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java @@ -1477,7 +1477,7 @@ public List pullNewlyIncreasedContainers() { writeLock.lock(); if (nmReportedIncreasedContainers.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } else { List container = new ArrayList(nmReportedIncreasedContainers.values()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeStatusEvent.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeStatusEvent.java index c79f2704a0..5f5fe24d17 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeStatusEvent.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeStatusEvent.java @@ -80,10 +80,9 @@ public void setLogAggregationReportsForApps( this.logAggregationReportsForApps = logAggregationReportsForApps; } - @SuppressWarnings("unchecked") public List getNMReportedIncreasedContainers() { return this.nodeStatus.getIncreasedContainers() == null ? - Collections.EMPTY_LIST : this.nodeStatus.getIncreasedContainers(); + Collections.emptyList() : this.nodeStatus.getIncreasedContainers(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/BatchedRequests.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/BatchedRequests.java index 6badfee03c..9f8bf3d3f2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/BatchedRequests.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/BatchedRequests.java @@ -131,7 +131,7 @@ public int getPlacementAttempt() { * @return Set of blacklisted Nodes. */ public Set getBlacklist(String tag) { - return blacklist.getOrDefault(tag, Collections.EMPTY_SET); + return blacklist.getOrDefault(tag, Collections.emptySet()); } /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/PlacementDispatcher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/PlacementDispatcher.java index 849eb210b1..2259d1b23d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/PlacementDispatcher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/PlacementDispatcher.java @@ -87,7 +87,7 @@ public List pullPlacedRequests( } return retList; } - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public List pullRejectedRequests( @@ -104,7 +104,7 @@ public List pullRejectedRequests( } return retList; } - return Collections.EMPTY_LIST; + return Collections.emptyList(); } void clearApplicationState(ApplicationId applicationId) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/SingleConstraintAppPlacementAllocator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/SingleConstraintAppPlacementAllocator.java index a04816bca9..ed0734503f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/SingleConstraintAppPlacementAllocator.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/SingleConstraintAppPlacementAllocator.java @@ -373,9 +373,8 @@ private void validateAndSetSchedulingRequest(SchedulingRequest newSchedulingRequ } @Override - @SuppressWarnings("unchecked") public Map getResourceRequests() { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java index 96e4451c95..de8f8f646b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java @@ -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; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java index ca43a95585..a8e269779d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java @@ -781,7 +781,7 @@ private Map getOtherConfigurations(String queueExpr) { } } - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /**