From f05d20060d25773f8378c38aafaf9f8422ce5441 Mon Sep 17 00:00:00 2001 From: jakubk Date: Fri, 16 Jul 2021 10:24:44 +0100 Subject: [PATCH] FIxup --- .../core/BalancedNodeSelectionStrategyChannel.java | 7 ++++++- .../dialogue/core/NodeSelectionStrategyChannel.java | 2 +- .../dialogue/core/ZeroUriNodeSelectionChannel.java | 2 +- .../PinUntilErrorNodeSelectionStrategyChannelTest.java | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dialogue-core/src/main/java/com/palantir/dialogue/core/BalancedNodeSelectionStrategyChannel.java b/dialogue-core/src/main/java/com/palantir/dialogue/core/BalancedNodeSelectionStrategyChannel.java index 769f097950..2158f49da7 100644 --- a/dialogue-core/src/main/java/com/palantir/dialogue/core/BalancedNodeSelectionStrategyChannel.java +++ b/dialogue-core/src/main/java/com/palantir/dialogue/core/BalancedNodeSelectionStrategyChannel.java @@ -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; @@ -127,6 +127,11 @@ public Optional> 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; diff --git a/dialogue-core/src/main/java/com/palantir/dialogue/core/NodeSelectionStrategyChannel.java b/dialogue-core/src/main/java/com/palantir/dialogue/core/NodeSelectionStrategyChannel.java index 4d210e0ab4..983597dda5 100644 --- a/dialogue-core/src/main/java/com/palantir/dialogue/core/NodeSelectionStrategyChannel.java +++ b/dialogue-core/src/main/java/com/palantir/dialogue/core/NodeSelectionStrategyChannel.java @@ -84,7 +84,7 @@ static NodeSelectingChannel create(Config cf, ImmutableList 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); } diff --git a/dialogue-core/src/main/java/com/palantir/dialogue/core/ZeroUriNodeSelectionChannel.java b/dialogue-core/src/main/java/com/palantir/dialogue/core/ZeroUriNodeSelectionChannel.java index 38c1f91cfc..04275cec4c 100644 --- a/dialogue-core/src/main/java/com/palantir/dialogue/core/ZeroUriNodeSelectionChannel.java +++ b/dialogue-core/src/main/java/com/palantir/dialogue/core/ZeroUriNodeSelectionChannel.java @@ -45,7 +45,7 @@ public Optional> 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)); } diff --git a/dialogue-core/src/test/java/com/palantir/dialogue/core/PinUntilErrorNodeSelectionStrategyChannelTest.java b/dialogue-core/src/test/java/com/palantir/dialogue/core/PinUntilErrorNodeSelectionStrategyChannelTest.java index c619ed120a..9c3a70ab28 100644 --- a/dialogue-core/src/test/java/com/palantir/dialogue/core/PinUntilErrorNodeSelectionStrategyChannelTest.java +++ b/dialogue-core/src/test/java/com/palantir/dialogue/core/PinUntilErrorNodeSelectionStrategyChannelTest.java @@ -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