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

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

commit 7e165573d50e5c78633967fa7d5bb5e517998f7c
Author: jiriOndrusek-agent <[email protected]>
AuthorDate: Tue Nov 10 13:51:27 2026 +0000

    Remove the JSR-236 paths of Spring's ConcurrentTaskScheduler in native mode 
after CAMEL-25675
    
    camel-hashicorp-vault renews tokens with a ConcurrentTaskScheduler, whose
    jakarta.enterprise.concurrent branches broke the native build.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../ConcurrentTaskSchedulerSubstitutions.java      | 98 ++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git 
a/extensions/hashicorp-vault/runtime/src/main/java/org/apache/camel/quarkus/component/hashicorp/vault/graal/ConcurrentTaskSchedulerSubstitutions.java
 
b/extensions/hashicorp-vault/runtime/src/main/java/org/apache/camel/quarkus/component/hashicorp/vault/graal/ConcurrentTaskSchedulerSubstitutions.java
new file mode 100644
index 00000000000..03dc2da7742
--- /dev/null
+++ 
b/extensions/hashicorp-vault/runtime/src/main/java/org/apache/camel/quarkus/component/hashicorp/vault/graal/ConcurrentTaskSchedulerSubstitutions.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.hashicorp.vault.graal;
+
+import java.time.Clock;
+import java.util.concurrent.Callable;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+
+import com.oracle.svm.core.annotate.Alias;
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.springframework.core.task.TaskRejectedException;
+import org.springframework.scheduling.Trigger;
+import org.springframework.scheduling.support.TaskUtils;
+import org.springframework.util.ErrorHandler;
+
+/**
+ * Remove the JSR-236 (jakarta.enterprise.concurrent) code paths of Spring's 
ConcurrentTaskScheduler, used by
+ * camel-hashicorp-vault for token renewal. The JSR-236 API is not on the 
classpath.
+ */
+@TargetClass(className = 
"org.springframework.scheduling.concurrent.ConcurrentTaskScheduler")
+final class ConcurrentTaskSchedulerSubstitutions {
+    @Alias
+    private ErrorHandler errorHandler;
+
+    @Alias
+    private Clock clock;
+
+    @Alias
+    private ScheduledExecutorService getScheduledExecutor() {
+        return null;
+    }
+
+    @Substitute
+    public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
+        ScheduledExecutorService scheduleExecutorToUse = 
getScheduledExecutor();
+        try {
+            ErrorHandler errorHandlerToUse = (this.errorHandler != null ? 
this.errorHandler
+                    : TaskUtils.getDefaultErrorHandler(true));
+            return new ReschedulingRunnableAlias(
+                    ((ConcurrentTaskExecutorAlias) (Object) 
this).decorateTaskIfNecessary(task), trigger, this.clock,
+                    scheduleExecutorToUse, errorHandlerToUse)
+                    .schedule();
+        } catch (RejectedExecutionException ex) {
+            throw new TaskRejectedException(scheduleExecutorToUse, task, ex);
+        }
+    }
+}
+
+@TargetClass(className = 
"org.springframework.scheduling.concurrent.ConcurrentTaskExecutor")
+final class ConcurrentTaskExecutorAlias {
+    @Alias
+    Runnable decorateTaskIfNecessary(Runnable task) {
+        return null;
+    }
+}
+
+@TargetClass(className = 
"org.springframework.scheduling.concurrent.ReschedulingRunnable")
+final class ReschedulingRunnableAlias {
+    @Alias
+    public ReschedulingRunnableAlias(Runnable delegate, Trigger trigger, Clock 
clock,
+            ScheduledExecutorService executor, ErrorHandler errorHandler) {
+    }
+
+    @Alias
+    public ScheduledFuture<?> schedule() {
+        return null;
+    }
+}
+
+@TargetClass(className = 
"org.springframework.scheduling.concurrent.ConcurrentTaskExecutor$ManagedTaskBuilder")
+final class ManagedTaskBuilderSubstitutions {
+    @Substitute
+    public static Runnable buildManagedTask(Runnable task, String 
identityName) {
+        return task;
+    }
+
+    @Substitute
+    public static <T> Callable<T> buildManagedTask(Callable<T> task, String 
identityName) {
+        return task;
+    }
+}

Reply via email to