[ 
https://issues.apache.org/jira/browse/HDFS-13981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16647747#comment-16647747
 ] 

Yiqun Lin commented on HDFS-13981:
----------------------------------

[~belugabehr], current change optimized the logic a lot. Would you mind fixing 
the findbugs?
Not so sure if following way can fix this:
From
{code}
      int spaceCmp = Long.compare(cluster2.getAvailableSpace(),
          cluster1.getAvailableSpace());

      boolean isBalancedPreference = (ThreadLocalRandom.current()
          .nextFloat() < balancedPreference);

      return isBalancedPreference ? spaceCmp : -spaceCmp;
{code}
to
{code}
      int spaceCmp = Long.compare(cluster2.getAvailableSpace(),
          cluster1.getAvailableSpace());

      int factor = (ThreadLocalRandom.current()
          .nextFloat() < balancedPreference) ? 1: -1;

      return factor * spaceCmp;
{code} 

> Review of AvailableSpaceResolver.java
> -------------------------------------
>
>                 Key: HDFS-13981
>                 URL: https://issues.apache.org/jira/browse/HDFS-13981
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: federation
>    Affects Versions: 3.2.0
>            Reporter: BELUGA BEHR
>            Assignee: BELUGA BEHR
>            Priority: Minor
>         Attachments: HDFS-13981.1.patch
>
>
> * No behavior changes, just optimizing and paring down the code



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to