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

grpc / grpc-java / #18883

03 Nov 2023 04:57PM UTC coverage: 88.246% (+0.03%) from 88.218%
#18883

push

github

web-flow
core, netty, okhttp: implement new logic for nameResolverFactory API in channelBuilder (#10590)

* core, netty, okhttp: implement new logic for nameResolverFactory API in channelBuilder
fix ManagedChannelImpl to use NameResolverRegistry instead of NameResolverFactory
fix the ManagedChannelImplBuilder and remove nameResolverFactory

* Integrate target parsing and NameResolverProvider searching

Actually creating the name resolver is now delayed to the end of
ManagedChannelImpl.getNameResolver; we don't want to call into the name
resolver to determine if we should use the name resolver.

Added getDefaultScheme() to NameResolverRegistry to avoid needing
NameResolver.Factory.
---------

Co-authored-by: Eric Anderson <ejona@google.com>

30370 of 34415 relevant lines covered (88.25%)

0.88 hits per line

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

84.62
/../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.internal.SharedResourcePool;
24
import io.netty.channel.unix.DomainSocketAddress;
25
import java.net.SocketAddress;
26
import java.util.Collection;
27
import java.util.Collections;
28

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

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

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

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

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

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

65
  @Override
66
  protected Collection<Class<? extends SocketAddress>> getSupportedSocketAddressTypes() {
67
    return Collections.singleton(DomainSocketAddress.class);
1✔
68
  }
69
}
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