Skip to content

Commit

Permalink
loadbalancer-experimental: make DefaultLoadBalancer the default RR im…
Browse files Browse the repository at this point in the history
…plementation (#3065)

* loadbalancer-experimental: make DefaultLoadBalancer the default RR implementation

Motivation:

It's been out a while now and DefaultLoadBalancer can exactly behave as
the old RoundRobinLoadBalancer. That means we can insert it in place of
RoundRobinLoadBalancer.

Modifications:

Default to building a DefaultLoadBalancer in round-robin compatibility mode
via the RoundRobinToDefaultLBMigrationProvider. We retain the flag for safety
for a few releases but will eventually remove it and RoundRobinLoadBalancer.
  • Loading branch information
bryce-anderson authored Sep 26, 2024
1 parent c063483 commit a75232b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ RoundRobinLoadBalancerBuilder<ResolvedAddress, C> newBuilder(
}

private static boolean isEnabled() {
return Boolean.getBoolean(PROPERTY_NAME);
// Enabled by default.
String propValue = System.getProperty(PROPERTY_NAME);
return propValue == null || Boolean.parseBoolean(propValue);
}

private static final class DefaultLoadBalancerRoundRobinBuilder<ResolvedAddress, C extends LoadBalancedConnection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void defaultValue() {
new RoundRobinLoadBalancerFactory.Builder<>();
RoundRobinLoadBalancerBuilder<String, TestLoadBalancedConnection> result = provider.newBuilder(
"builder", builder);
assertThat(result, sameInstance(builder));
assertThat(result.build(), instanceOf(DefaultLoadBalancerBuilder.DefaultLoadBalancerFactory.class));
}

@Test
Expand Down

0 comments on commit a75232b

Please sign in to comment.