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

grpc / grpc-java / #20320

17 Jun 2026 05:11PM UTC coverage: 88.886% (+0.01%) from 88.874%
#20320

push

github

web-flow
api: Add Grpc.newChannelBuilder accepting NameResolverRegistry (#11901)

This introduces a new `Grpc.newChannelBuilder` overload that allows callers to pass an explicit `NameResolverRegistry`. Fixes #11055

36550 of 41120 relevant lines covered (88.89%)

0.89 hits per line

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

90.0
/../netty/src/main/java/io/grpc/netty/UdsNettyChannelProvider.java
1
/*
2
 * Copyright 2015 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.netty;
18

19
import com.google.common.base.Preconditions;
20
import io.grpc.ChannelCredentials;
21
import io.grpc.Internal;
22
import io.grpc.ManagedChannelProvider;
23
import io.grpc.NameResolverProvider;
24
import io.grpc.NameResolverRegistry;
25
import io.grpc.internal.SharedResourcePool;
26
import io.netty.channel.unix.DomainSocketAddress;
27
import java.net.SocketAddress;
28
import java.util.Collection;
29
import java.util.Collections;
30

31
/** Provider for {@link NettyChannelBuilder} instances for UDS channels. */
32
@Internal
33
public final class UdsNettyChannelProvider extends ManagedChannelProvider {
1✔
34

35
  @Override
36
  public boolean isAvailable() {
37
    return (Utils.EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE != null);
1✔
38
  }
39

40
  @Override
41
  public int priority() {
42
    return 3;
1✔
43
  }
44

45
  @Override
46
  public NettyChannelBuilder builderForAddress(String name, int port) {
47
    throw new AssertionError("NettyChannelProvider shadows this implementation");
×
48
  }
49

50
  @Override
51
  public NettyChannelBuilder builderForTarget(String target) {
52
    throw new AssertionError("NettyChannelProvider shadows this implementation");
×
53
  }
54

55
  @Override
56
  public NewChannelBuilderResult newChannelBuilder(String target, ChannelCredentials creds) {
57
    Preconditions.checkState(isAvailable());
1✔
58
    NewChannelBuilderResult result = new NettyChannelProvider().newChannelBuilder(target, creds);
1✔
59
    if (result.getChannelBuilder() != null) {
1✔
60
      ((NettyChannelBuilder) result.getChannelBuilder())
1✔
61
          .eventLoopGroupPool(SharedResourcePool.forResource(Utils.DEFAULT_WORKER_EVENT_LOOP_GROUP))
1✔
62
          .channelType(Utils.EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE, DomainSocketAddress.class);
1✔
63
    }
64
    return result;
1✔
65
  }
66

67
  @Override
68
  public NewChannelBuilderResult newChannelBuilder(String target, ChannelCredentials creds,
69
                                                   NameResolverRegistry nameResolverRegistry,
70
                                                   NameResolverProvider nameResolverProvider) {
71
    Preconditions.checkState(isAvailable());
1✔
72
    NewChannelBuilderResult result = new NettyChannelProvider().newChannelBuilder(
1✔
73
        target, creds, nameResolverRegistry, nameResolverProvider);
74
    if (result.getChannelBuilder() != null) {
1✔
75
      ((NettyChannelBuilder) result.getChannelBuilder())
1✔
76
          .eventLoopGroupPool(SharedResourcePool.forResource(Utils.DEFAULT_WORKER_EVENT_LOOP_GROUP))
1✔
77
          .channelType(Utils.EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE, DomainSocketAddress.class);
1✔
78
    }
79
    return result;
1✔
80
  }
81

82
  @Override
83
  protected Collection<Class<? extends SocketAddress>> getSupportedSocketAddressTypes() {
84
    return Collections.singleton(DomainSocketAddress.class);
1✔
85
  }
86
}
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

© 2026 Coveralls, Inc