Skip to content

Commit

Permalink
ACCUMULO-4685 Fix minor type safety issues
Browse files Browse the repository at this point in the history
Use diamond operator and generic method for emptySet
  • Loading branch information
ctubbsii committed Jul 24, 2017
1 parent 62d43cb commit 0f061b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public class HostRegexTableLoadBalancer extends TableLoadBalancer implements Con
protected long oobCheckMillis = AccumuloConfiguration.getTimeInMillis(HOST_BALANCER_OOB_DEFAULT);

private static final long ONE_HOUR = 60 * 60 * 1000;
private static final Set<KeyExtent> EMPTY_MIGRATIONS = Collections.EMPTY_SET;
private static final Set<KeyExtent> EMPTY_MIGRATIONS = Collections.emptySet();

private Map<String,String> tableIdToTableName = null;
private Map<String,Pattern> poolNameToRegexPattern = null;
Expand Down Expand Up @@ -411,7 +411,7 @@ public long balance(SortedMap<TServerInstance,TabletServerStatus> current, Set<K
LOG.trace("Sample up to 10 outstanding migrations: {}", Iterables.limit(migrations, 10));
}
migrationsFromLastPass.keySet().retainAll(migrations);
SortedMap<TServerInstance,TabletServerStatus> currentCopy = new TreeMap(current);
SortedMap<TServerInstance,TabletServerStatus> currentCopy = new TreeMap<>(current);
Multimap<TServerInstance,String> serverTableIdCopied = HashMultimap.create();
for (TabletMigration migration : migrationsFromLastPass.values()) {
TableInfo fromInfo = getTableInfo(currentCopy, serverTableIdCopied, migration.tablet.getTableId().toString(), migration.oldServer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.apache.accumulo.core.master.thrift.TabletServerStatus;
import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
import org.apache.accumulo.fate.util.UtilWaitThread;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.conf.TableConfiguration;
import org.apache.accumulo.server.master.state.TServerInstance;
import org.apache.accumulo.server.master.state.TabletMigration;
Expand Down Expand Up @@ -77,7 +76,7 @@ public void testInit() {

@Test
public void testBalance() {
init((ServerConfiguration) factory);
init(factory);
Set<KeyExtent> migrations = new HashSet<KeyExtent>();
List<TabletMigration> migrationsOut = new ArrayList<TabletMigration>();
long wait = this.balance(Collections.unmodifiableSortedMap(createCurrent(15)), migrations, migrationsOut);
Expand Down

0 comments on commit 0f061b9

Please sign in to comment.