diff options
author | Kun Zhang <zhangkun83@users.noreply.github.com> | 2017-10-06 16:23:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 16:23:10 -0700 |
commit | 72f6d9bc08e2e37c890e13e036321f7049d5d6af (patch) | |
tree | 9d29f36adaa471ef67729e4cd811deaa35dcc388 /grpclb | |
parent | 291f17059eee0fee0bf0d0d6c3ddc6fc40e2a09c (diff) | |
download | grpc-grpc-java-72f6d9bc08e2e37c890e13e036321f7049d5d6af.tar.gz |
core: add first-class drop support in LoadBalancer.
Resolves #3355
GrpclbLoadBalancer should use PickResult.withDrop() instead of PickResult.withError() when dropping RPCs.
Diffstat (limited to 'grpclb')
-rw-r--r-- | grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java | 2 | ||||
-rw-r--r-- | grpclb/src/test/java/io/grpc/grpclb/GrpclbLoadBalancerTest.java | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java b/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java index 203f055e4..301f65985 100644 --- a/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java +++ b/grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java @@ -77,7 +77,7 @@ final class GrpclbState { @VisibleForTesting static final PickResult DROP_PICK_RESULT = - PickResult.withError(Status.UNAVAILABLE.withDescription("Dropped as requested by balancer")); + PickResult.withDrop(Status.UNAVAILABLE.withDescription("Dropped as requested by balancer")); @VisibleForTesting static final RoundRobinEntry BUFFER_ENTRY = new RoundRobinEntry() { diff --git a/grpclb/src/test/java/io/grpc/grpclb/GrpclbLoadBalancerTest.java b/grpclb/src/test/java/io/grpc/grpclb/GrpclbLoadBalancerTest.java index 23c2efb51..fc3beab67 100644 --- a/grpclb/src/test/java/io/grpc/grpclb/GrpclbLoadBalancerTest.java +++ b/grpclb/src/test/java/io/grpc/grpclb/GrpclbLoadBalancerTest.java @@ -293,6 +293,7 @@ public class GrpclbLoadBalancerTest { @Test public void roundRobinPickerWithDrop() { + assertTrue(DROP_PICK_RESULT.isDrop()); GrpclbClientLoadRecorder loadRecorder = new GrpclbClientLoadRecorder(timeProvider); Subchannel subchannel = mock(Subchannel.class); // 1 out of 2 requests are to be dropped |