accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo] branch master updated: Java Collections Improvements in DefaultLoadBalancer (#1319)
Date Fri, 30 Aug 2019 18:36:20 GMT
This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 27194c0  Java Collections Improvements in DefaultLoadBalancer (#1319)
27194c0 is described below

commit 27194c0a05fcf85488f74b4c94e682ac8913565f
Author: belugabehr <12578579+belugabehr@users.noreply.github.com>
AuthorDate: Fri Aug 30 13:36:15 2019 -0500

    Java Collections Improvements in DefaultLoadBalancer (#1319)
---
 .../accumulo/server/master/balancer/DefaultLoadBalancer.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
index 021b5ab..036d555 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
@@ -150,8 +150,7 @@ public class DefaultLoadBalancer extends TabletBalancer {
       }
 
       // order from low to high
-      Collections.sort(totals);
-      Collections.reverse(totals);
+      Collections.sort(totals, Collections.reverseOrder());
       int even = total / totals.size();
       int numServersOverEven = total % totals.size();
 
@@ -205,10 +204,11 @@ public class DefaultLoadBalancer extends TabletBalancer {
   List<TabletMigration> move(ServerCounts tooMuch, ServerCounts tooLittle, int count,
       Map<TableId,Map<KeyExtent,TabletStats>> donerTabletStats) {
 
-    List<TabletMigration> result = new ArrayList<>();
-    if (count == 0)
-      return result;
+    if (count == 0) {
+      return Collections.emptyList();
+    }
 
+    List<TabletMigration> result = new ArrayList<>();
     // Copy counts so we can update them as we propose migrations
     Map<TableId,Integer> tooMuchMap = tabletCountsPerTable(tooMuch.status);
     Map<TableId,Integer> tooLittleMap = tabletCountsPerTable(tooLittle.status);


Mime
View raw message