[
https://issues.apache.org/jira/browse/YARN-6519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15981633#comment-15981633
]
Naganarasimha G R commented on YARN-6519:
-----------------------------------------
Hi [~cheersyang],
few nits in the patch as follows :
# NodeType ln no 29, no need to change the access specifier of the constructor
# ApplicationMasterService ln no 396, {{EMPTY_CONTAINER_LIST}} can be private
and if required made default access in future
#AbstractYarnScheduler ln no 135, {{EMPTY_CONTAINER_LIST}} as above can be
private
# QueueMetrics ln no 151, i was of the opinion that we use naming convention of
field as its not exactly a string constant, thoughts?
# ProportionalCapacityPreemptionPolicy ln no 311-315, as we are modifying by
invoking {{preemptionCandidates.remove}} within the iterator whether is it
possible for concurrent modification exception ?
# FSSchedulerNode ln no 157-165, i presume for removal we better not use entry
set, as there is Concurrent Modification Exception possible
{code}
public static void main(String args[]){
Map<String,String> testMap = new HashMap<>();
testMap.put("1", "one");
testMap.put("2", "two");
testMap.put("3", "three");
testMap.put("4", "four");
for (Entry<String, String> entry : testMap.entrySet()) {
if (entry.getKey().equals("2")){
testMap.remove(entry.getKey());
}
}
}
{code}
> Fix warnings from Spotbugs in hadoop-yarn-server-resourcemanager
> ----------------------------------------------------------------
>
> Key: YARN-6519
> URL: https://issues.apache.org/jira/browse/YARN-6519
> Project: Hadoop YARN
> Issue Type: Bug
> Components: resourcemanager
> Reporter: Weiwei Yang
> Assignee: Weiwei Yang
> Labels: findbugs
> Attachments: YARN-6519.001.patch
>
>
> There is 8 findbugs warning in hadoop-yarn-server-timelineservice since
> switched to spotbugs
> #
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerQueueManager$1.compare(CSQueue,
> CSQueue) incorrectly handles float value
> # org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType.index
> field is public and mutable
> #
> org.apache.hadoop.yarn.server.resourcemanager.ApplicationMasterService.EMPTY_CONTAINER_LIST
> is a mutable collection which should be package protected
> #
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler.EMPTY_CONTAINER_LIST
> is a mutable collection which should be package protected
> #
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics.queueMetrics
> is a mutable collection
> #
> org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.ProportionalCapacityPreemptionPolicy.cleanupStaledPreemptionCandidates(long)
> makes inefficient use of keySet iterator instead of entrySet iterator
> #
> org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl.transferStateFromAttempt(RMAppAttempt)
> makes inefficient use of keySet iterator instead of entrySet iterator
> #
> org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSSchedulerNode.cleanupPreemptionList()
> makes inefficient use of keySet iterator instead of entrySet iterator
> See more from
> [https://builds.apache.org/job/PreCommit-HADOOP-Build/12157/artifact/patchprocess/branch-findbugs-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-resourcemanager-warnings.html]
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]