Skip to content

Commit

Permalink
Revert "Add more netty tweaks to make reactor-netty work on top of qu…
Browse files Browse the repository at this point in the history
…arkus-netty"

This reverts commit f57fee2.
  • Loading branch information
gsmet committed Feb 8, 2021
1 parent a31d104 commit 3121bac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import java.util.Optional;
import java.util.Random;
import java.util.function.Supplier;
import java.util.stream.Stream;

import javax.inject.Singleton;

import org.jboss.logging.Logger;
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;
Expand Down Expand Up @@ -184,9 +182,9 @@ void registerEventLoopBeans(BuildProducer<SyntheticBeanBuildItem> 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)
Expand Down Expand Up @@ -241,15 +239,9 @@ public List<UnsafeAccessedFieldBuildItem> unsafeAccessedFields() {
}

@BuildStep
void runtimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<String> DEFAULT_CIPHERS = Collections.emptyList();

@Alias
@RecomputeFieldValue(kind = Kind.FromAlias)
static Set<String> AVAILABLE_CIPHER_SUITES = Collections.emptySet();

@Alias
@RecomputeFieldValue(kind = Kind.FromAlias)
private static Set<String> AVAILABLE_OPENSSL_CIPHER_SUITES = Collections.emptySet();

@Alias
@RecomputeFieldValue(kind = Kind.FromAlias)
private static Set<String> 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<String> 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 {

Expand Down

0 comments on commit 3121bac

Please sign in to comment.