You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/04/23 13:59:34 UTC

[camel-quarkus] 01/01: Register required AHC classes for runtime initialization

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch quarkus-master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 09e1236595f5580c8216c5d04185eeb885e70db7
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Apr 23 14:46:38 2020 +0100

    Register required AHC classes for runtime initialization
    
    Fixes #1126
---
 .../support/ahc/deployment/SupportAhcProcessor.java       | 15 +++++++++++++++
 .../component/ahc/ws/deployment/AhcWsProcessor.java       |  5 +++++
 2 files changed, 20 insertions(+)

diff --git a/extensions-support/ahc/deployment/src/main/java/org/apache/camel/quarkus/component/support/ahc/deployment/SupportAhcProcessor.java b/extensions-support/ahc/deployment/src/main/java/org/apache/camel/quarkus/component/support/ahc/deployment/SupportAhcProcessor.java
index 9ae0aa8..dc1c53f 100644
--- a/extensions-support/ahc/deployment/src/main/java/org/apache/camel/quarkus/component/support/ahc/deployment/SupportAhcProcessor.java
+++ b/extensions-support/ahc/deployment/src/main/java/org/apache/camel/quarkus/component/support/ahc/deployment/SupportAhcProcessor.java
@@ -16,14 +16,22 @@
  */
 package org.apache.camel.quarkus.component.support.ahc.deployment;
 
+import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
 
 class SupportAhcProcessor {
 
     private static final String FEATURE = "camel-support-ahc";
+    private static final String[] RUNTIME_INITIALIZED_CLASSES = new String[] {
+            "org.asynchttpclient.netty.channel.ChannelManager",
+            "org.asynchttpclient.netty.request.NettyRequestSender",
+            "org.asynchttpclient.RequestBuilderBase",
+            "org.asynchttpclient.resolver.RequestHostnameResolver"
+    };
 
     @BuildStep
     FeatureBuildItem feature() {
@@ -42,4 +50,11 @@ class SupportAhcProcessor {
         return new ExtensionSslNativeSupportBuildItem(FEATURE);
     }
 
+    @BuildStep
+    void runtimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClass) {
+        for (String className : RUNTIME_INITIALIZED_CLASSES) {
+            runtimeInitializedClass
+                    .produce(new RuntimeInitializedClassBuildItem(className));
+        }
+    }
 }
diff --git a/extensions/ahc-ws/deployment/src/main/java/org/apache/camel/quarkus/component/ahc/ws/deployment/AhcWsProcessor.java b/extensions/ahc-ws/deployment/src/main/java/org/apache/camel/quarkus/component/ahc/ws/deployment/AhcWsProcessor.java
index 09d5671..5171ec1 100644
--- a/extensions/ahc-ws/deployment/src/main/java/org/apache/camel/quarkus/component/ahc/ws/deployment/AhcWsProcessor.java
+++ b/extensions/ahc-ws/deployment/src/main/java/org/apache/camel/quarkus/component/ahc/ws/deployment/AhcWsProcessor.java
@@ -18,6 +18,7 @@ package org.apache.camel.quarkus.component.ahc.ws.deployment;
 
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
 
 class AhcWsProcessor {
 
@@ -28,4 +29,8 @@ class AhcWsProcessor {
         return new FeatureBuildItem(FEATURE);
     }
 
+    @BuildStep
+    RuntimeInitializedClassBuildItem runtimeInitializedClasses() {
+        return new RuntimeInitializedClassBuildItem("org.asynchttpclient.netty.ws.NettyWebSocket");
+    }
 }