From 3121bac40ae8e6275d25ed60cb91a447f8699d3a Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 8 Feb 2021 12:44:01 +0100 Subject: [PATCH] Revert "Add more netty tweaks to make reactor-netty work on top of quarkus-netty" This reverts commit f57fee28c65fcb7bb0ccaba7260c0013bce55879. --- .../netty/deployment/NettyProcessor.java | 20 ++--- .../runtime/graal/NettySubstitutions.java | 85 ------------------- 2 files changed, 6 insertions(+), 99 deletions(-) diff --git a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java index 1374c2167f87c..302aa49f319bb 100644 --- a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java +++ b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java @@ -5,7 +5,6 @@ import java.util.Optional; import java.util.Random; import java.util.function.Supplier; -import java.util.stream.Stream; import javax.inject.Singleton; @@ -13,7 +12,6 @@ import org.jboss.logmanager.Level; import io.netty.channel.EventLoopGroup; -import io.netty.util.NetUtil; import io.netty.util.internal.PlatformDependent; import io.netty.util.internal.logging.InternalLoggerFactory; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; @@ -184,9 +182,9 @@ void registerEventLoopBeans(BuildProducer syntheticBeans } // IMPLEMENTATION NOTE: - // We use Singleton scope for both beans. ApplicationScoped causes problems with EventLoopGroup.next() - // which overrides the EventExecutorGroup.next() method but since Netty 4 is compiled with JDK6 the corresponding bridge method - // is not generated and the invocation upon the client proxy results in an AbstractMethodError + // We use Singleton scope for both beans. ApplicationScoped causes problems with EventLoopGroup.next() + // which overrides the EventExecutorGroup.next() method but since Netty 4 is compiled with JDK6 the corresponding bridge method + // is not generated and the invocation upon the client proxy results in an AbstractMethodError syntheticBeans.produce(SyntheticBeanBuildItem.configure(EventLoopGroup.class) .supplier(boss) .scope(Singleton.class) @@ -241,15 +239,9 @@ public List unsafeAccessedFields() { } @BuildStep - void runtimeInitializedClasses(BuildProducer runtimeInitializedClasses) { - Stream.of( - EmptyByteBufStub.class, // holds a direct allocated byte buffer that needs to be initialized at run time - NetUtil.class) - - .map(Class::getName) - .map(RuntimeInitializedClassBuildItem::new) - .forEach(runtimeInitializedClasses::produce); - + RuntimeInitializedClassBuildItem runtimeInitBcryptUtil() { + // this holds a direct allocated byte buffer that needs to be initialised at run time + return new RuntimeInitializedClassBuildItem(EmptyByteBufStub.class.getName()); } //if debug logging is enabled netty logs lots of exceptions diff --git a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java index cd73b7fc2cb2b..bb629e7d0c268 100644 --- a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java +++ b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java @@ -4,10 +4,7 @@ import java.security.PrivateKey; import java.security.Provider; import java.security.cert.X509Certificate; -import java.util.Collections; -import java.util.List; import java.util.Queue; -import java.util.Set; import java.util.concurrent.LinkedBlockingDeque; import javax.net.ssl.KeyManagerFactory; @@ -17,7 +14,6 @@ import com.oracle.svm.core.annotate.Alias; import com.oracle.svm.core.annotate.RecomputeFieldValue; -import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.jdk.JDK11OrLater; @@ -57,87 +53,6 @@ private static InternalLoggerFactory newDefaultFactory(String name) { // SSL // This whole section is mostly about removing static analysis references to openssl/tcnative -@TargetClass(className = "io.netty.handler.ssl.SslProvider") -final class Target_io_netty_handler_ssl_SslProvider { - @Substitute - public static boolean isAlpnSupported(final SslProvider provider) { - switch (provider) { - case JDK: - return Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator.isAlpnSupported(); - case OPENSSL: - case OPENSSL_REFCNT: - return false; - default: - throw new Error("SslProvider unsupported on Quarkus " + provider); - } - } -} - -@TargetClass(className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator") -final class Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator { - @Alias - static boolean isAlpnSupported() { - return true; - } -} - -/** Hardcode io.netty.handler.ssl.OpenSsl as non-available */ -@TargetClass(className = "io.netty.handler.ssl.OpenSsl") -final class Target_io_netty_handler_ssl_OpenSsl { - - @Alias - @RecomputeFieldValue(kind = Kind.FromAlias) - private static Throwable UNAVAILABILITY_CAUSE = new RuntimeException("OpenSsl unsupported on Quarkus"); - - @Alias - @RecomputeFieldValue(kind = Kind.FromAlias) - static List DEFAULT_CIPHERS = Collections.emptyList(); - - @Alias - @RecomputeFieldValue(kind = Kind.FromAlias) - static Set AVAILABLE_CIPHER_SUITES = Collections.emptySet(); - - @Alias - @RecomputeFieldValue(kind = Kind.FromAlias) - private static Set AVAILABLE_OPENSSL_CIPHER_SUITES = Collections.emptySet(); - - @Alias - @RecomputeFieldValue(kind = Kind.FromAlias) - private static Set AVAILABLE_JAVA_CIPHER_SUITES = Collections.emptySet(); - - @Alias - @RecomputeFieldValue(kind = Kind.FromAlias) - private static boolean SUPPORTS_KEYMANAGER_FACTORY = false; - - @Alias - @RecomputeFieldValue(kind = Kind.FromAlias) - private static boolean SUPPORTS_OCSP = false; - - @Alias - @RecomputeFieldValue(kind = Kind.FromAlias) - static Set SUPPORTED_PROTOCOLS_SET = Collections.emptySet(); - - @Substitute - public static boolean isAvailable() { - return false; - } - - @Substitute - public static int version() { - return -1; - } - - @Substitute - public static String versionString() { - return null; - } - - @Substitute - public static boolean isCipherSuiteAvailable(String cipherSuite) { - return false; - } -} - @TargetClass(className = "io.netty.handler.ssl.JdkSslServerContext") final class Target_io_netty_handler_ssl_JdkSslServerContext {