Skip to content

Commit

Permalink
Merge pull request #26047 from cescoffier/update-grpc-1.47.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cescoffier committed Jun 10, 2022
2 parents 40db70f + cb1ca8b commit 924f94d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package io.quarkus.grpc.common.runtime.graal;

import java.net.URI;
import java.security.Provider;
import java.util.function.BooleanSupplier;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import io.grpc.NameResolver;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.SslProvider;
Expand Down Expand Up @@ -69,6 +72,34 @@ private static Throwable getEpollUnavailabilityCause() {
}
}

@TargetClass(className = "io.grpc.netty.UdsNameResolverProvider", onlyWith = NoDomainSocketPredicate.class)
final class Target_io_grpc_netty_UdsNameResolverProvider {

@Substitute
protected boolean isAvailable() {
return false;
}

@Substitute
public Object newNameResolver(URI targetUri, NameResolver.Args args) {
// gRPC calls this method without calling isAvailable, so, make sure we do not touch the UdsNameResolver class.
// (as it requires domain sockets)
return null;
}
}

final class NoDomainSocketPredicate implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
try {
this.getClass().getClassLoader().loadClass("io.netty.channel.unix.DomainSocketAddress");
return false;
} catch (Exception ignored) {
return true;
}
}
}

@SuppressWarnings("unused")
class GrpcNettySubstitutions {
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<!-- Dependency versions -->

<!-- Make sure to check compatibility between these 2 gRPC components before upgrade -->
<grpc.version>1.46.0</grpc.version> <!-- when updating, verify if com.google.auth should not be updated too -->
<grpc.version>1.47.0</grpc.version> <!-- when updating, verify if com.google.auth should not be updated too -->
<grpc-jprotoc.version>1.2.1</grpc-jprotoc.version>
<protoc.version>3.19.3</protoc.version>
<protobuf-java.version>${protoc.version}</protobuf-java.version>
Expand Down

0 comments on commit 924f94d

Please sign in to comment.