Skip to content

Commit

Permalink
FIxup
Browse files Browse the repository at this point in the history
  • Loading branch information
jkozlowski committed Jul 16, 2021
1 parent f08a004 commit f05d200
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* workloads (where n requests must all land on the same server) or scenarios where cache warming is very important.
* {@link PinUntilErrorNodeSelectionStrategyChannel} remains the best choice for these.
*/
final class BalancedNodeSelectionStrategyChannel implements LimitedChannel {
final class BalancedNodeSelectionStrategyChannel implements NodeSelectingChannel {
private static final Logger log = LoggerFactory.getLogger(BalancedNodeSelectionStrategyChannel.class);

private static final int INFLIGHT_COMPARISON_THRESHOLD = 5;
Expand Down Expand Up @@ -127,6 +127,11 @@ public Optional<ListenableFuture<Response>> maybeExecute(
return Optional.empty();
}

@Override
public void routeToHost(int index, Request request) {
StickyAttachments.routeToChannel(request, channels.get(index));
}

private static final class BalancedChannel implements LimitedChannel {
private final LimitedChannel delegate;
private final ChannelScoreInfo channelInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static NodeSelectingChannel create(Config cf, ImmutableList<LimitedChannel> chan
private LimitedChannel delegate = channels.get(0);

@Override
public void routeToHost(int index, Request request) {
public void routeToHost(int _index, Request request) {
StickyAttachments.routeToChannel(request, delegate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Optional<ListenableFuture<Response>> maybeExecute(
}

@Override
public void routeToHost(int index, Request request) {
public void routeToHost(int _index, Request _request) {
throw new SafeIllegalStateException(
"There are no URIs configured to handle requests", SafeArg.of("channel", channelName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public void before() {
channels, pseudo, clock, metrics, channelName);

pinUntilErrorWithoutReshuffle =
new PinUntilErrorNodeSelectionStrategyChannel(constantList, 1, metrics, channelName);
pinUntilError = new PinUntilErrorNodeSelectionStrategyChannel(shufflingList, 1, metrics, channelName);
new PinUntilErrorNodeSelectionStrategyChannel(null, constantList, 1, metrics, channelName);
pinUntilError = new PinUntilErrorNodeSelectionStrategyChannel(null, shufflingList, 1, metrics, channelName);
}

@Test
Expand Down

0 comments on commit f05d200

Please sign in to comment.