Skip to content

Commit

Permalink
Deprecate GrpcChannelDescriptor methods for setting NameResolver due …
Browse files Browse the repository at this point in the history
…to deprecation of corresponding methods in the gRPC Java API.
  • Loading branch information
thegridman committed Dec 11, 2023
1 parent 386c089 commit fc8855e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Expand Up @@ -102,9 +102,14 @@ public Optional<String> loadBalancerPolicy() {

/**
* Get the {@link NameResolver.Factory} to use.
* <p/>
* This method is deprecated due to the deprecation of the
* {@link io.grpc.ManagedChannelBuilder#nameResolverFactory(io.grpc.NameResolver.Factory)}
* method in the gRPC Java API.
*
* @return the optional {@link NameResolver.Factory} to use
*/
@Deprecated
public Optional<NameResolver.Factory> nameResolverFactory() {
return Optional.ofNullable(nameResolver);
}
Expand Down Expand Up @@ -223,11 +228,16 @@ public Builder loadBalancerPolicy(String policy) {
/**
* Set the {@link io.grpc.NameResolver.Factory} to use.
* @param factory the {@link io.grpc.NameResolver.Factory} to use
* <p/>
* This method is deprecated due to the deprecation of the
* {@link io.grpc.ManagedChannelBuilder#nameResolverFactory(io.grpc.NameResolver.Factory)}
* method in the gRPC Java API.
*
* @return this instance for fluent API
*
* @see io.grpc.ManagedChannelBuilder#nameResolverFactory(io.grpc.NameResolver.Factory)
*/
@Deprecated
public Builder nameResolverFactory(NameResolver.Factory factory) {
this.nameResolver = factory;
return this;
Expand Down
Expand Up @@ -155,6 +155,7 @@ Map<String, GrpcChannelDescriptor> channels() {
return channelConfigs;
}

@SuppressWarnings("deprecation")
private ManagedChannel createChannel(GrpcChannelDescriptor descriptor) {
ManagedChannelBuilder<?> builder = descriptor.tlsDescriptor()
.map(tlsDescriptor -> createNettyChannelBuilder(descriptor, tlsDescriptor))
Expand Down
Expand Up @@ -36,6 +36,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;

@SuppressWarnings("deprecation")
public class GrpcChannelsProviderTest {

private static final String CLIENT_CERT = "ssl/clientCert.pem";
Expand Down

0 comments on commit fc8855e

Please sign in to comment.