• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #19231

13 May 2024 11:29PM UTC coverage: 88.419% (-0.02%) from 88.443%
#19231

push

github

ejona86
rls: Guarantee backoff will update RLS picker

Previously, picker was likely null if entering backoff soon after
start-up. This prevented the picker from being updated and directing
queued RPCs to the fallback. It would work for new RPCs if RLS returned
extremely rapidly; both ManagedChannelImpl and DelayedClientTransport do
a pick before enqueuing so the ManagedChannelImpl pick could request
from RLS and DelayedClientTransport could use the response. So the test
uses a delay to purposefully avoid that unlikely-in-real-life case.

Creating a resolving OOB channel for InProcess doesn't actually change
the destination from the parent, because InProcess uses directaddress.
Thus the fakeRlsServiceImpl is now being added to the fake backend
server, because the same server is used for RLS within the test.

b/333185213

31615 of 35756 relevant lines covered (88.42%)

0.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.62
/../core/src/main/java/io/grpc/internal/PickSubchannelArgsImpl.java
1
/*
2
 * Copyright 2016 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.internal;
18

19
import static com.google.common.base.Preconditions.checkNotNull;
20

21
import com.google.common.base.Objects;
22
import io.grpc.CallOptions;
23
import io.grpc.LoadBalancer.PickDetailsConsumer;
24
import io.grpc.LoadBalancer.PickSubchannelArgs;
25
import io.grpc.Metadata;
26
import io.grpc.MethodDescriptor;
27

28
/** Implementation of {@link PickSubchannelArgs}. */
29
public final class PickSubchannelArgsImpl extends PickSubchannelArgs {
30
  private final CallOptions callOptions;
31
  private final Metadata headers;
32
  private final MethodDescriptor<?, ?> method;
33
  private final PickDetailsConsumer pickDetailsConsumer;
34

35
  /**
36
   * Creates call args object for given method with its call options, metadata.
37
   */
38
  public PickSubchannelArgsImpl(
39
      MethodDescriptor<?, ?> method, Metadata headers, CallOptions callOptions,
40
      PickDetailsConsumer pickDetailsConsumer) {
1✔
41
    this.method = checkNotNull(method, "method");
1✔
42
    this.headers = checkNotNull(headers, "headers");
1✔
43
    this.callOptions = checkNotNull(callOptions, "callOptions");
1✔
44
    this.pickDetailsConsumer = checkNotNull(pickDetailsConsumer, "pickDetailsConsumer");
1✔
45
  }
1✔
46

47
  @Override
48
  public Metadata getHeaders() {
49
    return headers;
1✔
50
  }
51

52
  @Override
53
  public CallOptions getCallOptions() {
54
    return callOptions;
1✔
55
  }
56

57
  @Override
58
  public MethodDescriptor<?, ?> getMethodDescriptor() {
59
    return method;
1✔
60
  }
61

62
  @Override
63
  public PickDetailsConsumer getPickDetailsConsumer() {
64
    return pickDetailsConsumer;
1✔
65
  }
66

67
  @Override
68
  public boolean equals(Object o) {
69
    if (this == o) {
×
70
      return true;
×
71
    }
72
    if (o == null || getClass() != o.getClass()) {
×
73
      return false;
×
74
    }
75
    PickSubchannelArgsImpl that = (PickSubchannelArgsImpl) o;
×
76
    return Objects.equal(callOptions, that.callOptions)
×
77
        && Objects.equal(headers, that.headers)
×
78
        && Objects.equal(method, that.method)
×
79
        && Objects.equal(pickDetailsConsumer, that.pickDetailsConsumer);
×
80
  }
81

82
  @Override
83
  public int hashCode() {
84
    return Objects.hashCode(callOptions, headers, method, pickDetailsConsumer);
×
85
  }
86

87
  @Override
88
  public final String toString() {
89
    return "[method=" + method + " headers=" + headers + " callOptions=" + callOptions + "]";
×
90
  }
91
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc