Varun Saxena commented on YARN-2937:

bq.  What's the problem around Random?
There is a problem with Maths#abs. 
{{Maths.abs(Long.MIN_VALUE)==Long.MIN_VALUE}} i.e. Maths.abs doesnt work with 
lowest value of long. But Random may return that value. So changed Random to 
RandomUtils to give only positive values. Maths.abs can probably be removed in 
this case. Random has {{getInt}} method which can return positive values but no 
corresponding method for nextLong

bq. Can we use IOUtils?
Yes, will use it.

bq. Is this removed because bufReader will consequently close fileReader too?
No. This has been removed because instance of class {{FileReader}} has been 
removed and replaced with {{FileInputStream}} + {{InputStreamReader}}. This is 
because FileReader doesnt allow us to set Charset encoding. And yes, 
BufferedReader will close the underlying FileReader and FileReader will close 
the underlying stream.

bq.  Again, would you mind explaining a bit about what have been excluded in 
The exclusions are corresponding to *RV_RETURN_VALUE_IGNORED_BAD_PRACTICE*. 
Findbugs was complaining about return value of {{ThreadPoolExecutor#submit}} 
being ignored. This method returns a {{Future<T>}} object. Generally 
{{Future#get}} is called to check the return value of executor. But this method 
is blocking and waits for thread execution to complete. If I call this, it 
would break the current behavior. Tried it as well and some test cases failed. 
Another alternative is to call {{Future#isDone}} but this most likely will 
always return false if you check it immediately. So I see no point in checking 
return value of call to submit. Hence, added it in exclusions. Findbugs was 
raising issue for below 2 lines.

> Fix new findbugs warnings in hadoop-yarn-nodemanager
> ----------------------------------------------------
>                 Key: YARN-2937
>                 URL: https://issues.apache.org/jira/browse/YARN-2937
>             Project: Hadoop YARN
>          Issue Type: Improvement
>            Reporter: Varun Saxena
>            Assignee: Varun Saxena
>             Fix For: 2.7.0
>         Attachments: HADOOP-11373.patch, YARN-2937.001.patch, 
> YARN-2937.002.patch, YARN-2937.003.patch

This message was sent by Atlassian JIRA

Reply via email to