@Test public void testInit() { init(); assertEquals("OOB check interval value is incorrect", 7000, this.getOobCheckMillis()); assertEquals("Max migrations is incorrect", 4, this.getMaxMigrations()); assertEquals("Max outstanding migrations is incorrect", 10, this.getMaxOutstandingMigrations()); assertFalse(isIpBasedRegex()); Map<String,Pattern> patterns = this.getPoolNameToRegexPattern(); assertEquals(2, patterns.size()); assertTrue(patterns.containsKey(FOO.getTableName())); assertEquals(Pattern.compile("r01.*").pattern(), patterns.get(FOO.getTableName()).pattern()); assertTrue(patterns.containsKey(BAR.getTableName())); assertEquals(Pattern.compile("r02.*").pattern(), patterns.get(BAR.getTableName()).pattern()); }
@Override public void init(ServerContext context) { super.init(context); this.hrtlbConf = context.getConfiguration().newDeriver(HrtlbConf::new); tablesRegExCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.HOURS).build(new CacheLoader<>() { @Override public Deriver<Map<String,String>> load(TableId key) throws Exception { return context.getTableConfiguration(key) .newDeriver(HostRegexTableLoadBalancer::getRegexes); } }); LOG.info("{}", this); }
HostRegexTableLoadBalancer extends TableLoadBalancer { @Override public void init(ServerContext context) { super.init(context); this.hrtlbConf = context.getConfiguration().newDeriver(HrtlbConf::new); tablesRegExCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.HOURS).build(new CacheLoader<>() { @Override public Deriver<Map<String,String>> load(TableId key) throws Exception { return context.getTableConfiguration(key) .newDeriver(HostRegexTableLoadBalancer::getRegexes); } }); LOG.info("{}", this); } }
HostRegexTableLoadBalancer extends TableLoadBalancer { @Override public void init(ServerContext context) { super.init(context); this.hrtlbConf = context.getConfiguration().newDeriver(HrtlbConf::new); tablesRegExCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.HOURS).build(new CacheLoader<>() { @Override public Deriver<Map<String,String>> load(TableId key) throws Exception { return context.getTableConfiguration(key) .newDeriver(HostRegexTableLoadBalancer::getRegexes); } }); LOG.info("{}", this); }  }
HostRegexTableLoadBalancer extends TableLoadBalancer { @Override public void init(ServerContext context) { super.init(context); this.hrtlbConf = context.getConfiguration().newDeriver(HrtlbConf::new); tablesRegExCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.HOURS).build(new CacheLoader<>() { @Override public Deriver<Map<String,String>> load(TableId key) throws Exception { return context.getTableConfiguration(key) .newDeriver(HostRegexTableLoadBalancer::getRegexes); } }); LOG.info("{}", this); }  @Override String toString(); Map<String,Pattern> getPoolNameToRegexPattern(); int getMaxMigrations(); int getMaxOutstandingMigrations(); long getOobCheckMillis(); boolean isIpBasedRegex(); @Override void init(ServerContext context); @Override void getAssignments(SortedMap<TServerInstance,TabletServerStatus> current,
      Map<KeyExtent,TServerInstance> unassigned, Map<KeyExtent,TServerInstance> assignments); @Override long balance(SortedMap<TServerInstance,TabletServerStatus> current,
      Set<KeyExtent> migrations, List<TabletMigration> migrationsOut); }
HostRegexTableLoadBalancer extends TableLoadBalancer { @Override public void init(ServerContext context) { super.init(context); this.hrtlbConf = context.getConfiguration().newDeriver(HrtlbConf::new); tablesRegExCache = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.HOURS).build(new CacheLoader<>() { @Override public Deriver<Map<String,String>> load(TableId key) throws Exception { return context.getTableConfiguration(key) .newDeriver(HostRegexTableLoadBalancer::getRegexes); } }); LOG.info("{}", this); }  @Override String toString(); Map<String,Pattern> getPoolNameToRegexPattern(); int getMaxMigrations(); int getMaxOutstandingMigrations(); long getOobCheckMillis(); boolean isIpBasedRegex(); @Override void init(ServerContext context); @Override void getAssignments(SortedMap<TServerInstance,TabletServerStatus> current,
      Map<KeyExtent,TServerInstance> unassigned, Map<KeyExtent,TServerInstance> assignments); @Override long balance(SortedMap<TServerInstance,TabletServerStatus> current,
      Set<KeyExtent> migrations, List<TabletMigration> migrationsOut); static final String HOST_BALANCER_PREFIX; static final String HOST_BALANCER_OOB_CHECK_KEY; static final String HOST_BALANCER_REGEX_USING_IPS_KEY; static final String HOST_BALANCER_REGEX_MAX_MIGRATIONS_KEY; static final String HOST_BALANCER_OUTSTANDING_MIGRATIONS_KEY; }