Remove deprecated nameResolverFactory method. (#7132)

This commit is contained in:
吴晟 Wu Sheng 2021-06-18 20:14:51 +08:00 committed by GitHub
parent 4698681e7c
commit e21cb196fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -11,6 +11,7 @@ Release Notes.
* Supports modifying span attributes in async mode.
* Agent supports the collection of JVM arguments and jar dependency information.
* [Temporary] Support authentication for log report channel. This feature and grpc channel is going to be removed after Satellite 0.2.0 release.
* Remove deprecated gRPC method, `io.grpc.ManagedChannelBuilder#nameResolverFactory`. See [gRPC-java 7133](https://github.com/grpc/grpc-java/issues/7133) for more details.
#### OAP-Backend
* Disable Spring sleuth meter analyzer by default.

View File

@ -22,6 +22,8 @@ import io.grpc.Channel;
import io.grpc.ConnectivityState;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.NameResolverRegistry;
import io.grpc.internal.DnsNameResolverProvider;
import io.grpc.netty.NettyChannelBuilder;
import java.util.LinkedList;
import java.util.List;
@ -34,9 +36,11 @@ public class GRPCChannel {
private final Channel channelWithDecorators;
private GRPCChannel(String host, int port, List<ChannelBuilder> channelBuilders,
List<ChannelDecorator> decorators) throws Exception {
List<ChannelDecorator> decorators) throws Exception {
ManagedChannelBuilder channelBuilder = NettyChannelBuilder.forAddress(host, port);
NameResolverRegistry.getDefaultRegistry().register(new DnsNameResolverProvider());
for (ChannelBuilder builder : channelBuilders) {
channelBuilder = builder.build(channelBuilder);
}

View File

@ -19,15 +19,13 @@
package org.apache.skywalking.apm.agent.core.remote;
import io.grpc.ManagedChannelBuilder;
import io.grpc.internal.DnsNameResolverProvider;
public class StandardChannelBuilder implements ChannelBuilder {
private final static int MAX_INBOUND_MESSAGE_SIZE = 1024 * 1024 * 50;
@Override
public ManagedChannelBuilder build(ManagedChannelBuilder managedChannelBuilder) {
return managedChannelBuilder.nameResolverFactory(new DnsNameResolverProvider())
.maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE)
return managedChannelBuilder.maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE)
.usePlaintext();
}
}