You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gi...@apache.org on 2025/05/21 01:53:12 UTC
(camel-quarkus) 20/34: Fix com.cedarsoftware:java-util ThreadedLRUCacheStrategy static scheduler field for native mode
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 9bccb0380e0dbb9456fe12f79b583e4c1c755d9c
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue May 6 13:27:18 2025 +0100
Fix com.cedarsoftware:java-util ThreadedLRUCacheStrategy static scheduler field for native mode
---
extensions/headersmap/runtime/pom.xml | 5 +++
.../ThreadedLRUCacheStrategySubstitutions.java | 40 ++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/extensions/headersmap/runtime/pom.xml b/extensions/headersmap/runtime/pom.xml
index 2cb790c7ec..3ad331d488 100644
--- a/extensions/headersmap/runtime/pom.xml
+++ b/extensions/headersmap/runtime/pom.xml
@@ -44,6 +44,11 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-headersmap</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.graalvm.sdk</groupId>
+ <artifactId>graal-sdk</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/headersmap/runtime/src/main/java/org/apache/camel/quarkus/component/headersmap/graal/ThreadedLRUCacheStrategySubstitutions.java b/extensions/headersmap/runtime/src/main/java/org/apache/camel/quarkus/component/headersmap/graal/ThreadedLRUCacheStrategySubstitutions.java
new file mode 100644
index 0000000000..43230c4c8f
--- /dev/null
+++ b/extensions/headersmap/runtime/src/main/java/org/apache/camel/quarkus/component/headersmap/graal/ThreadedLRUCacheStrategySubstitutions.java
@@ -0,0 +1,40 @@
+/*
+ * 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.headersmap.graal;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+
+import com.cedarsoftware.util.cache.ThreadedLRUCacheStrategy;
+import com.oracle.svm.core.annotate.Alias;
+import com.oracle.svm.core.annotate.RecomputeFieldValue;
+import com.oracle.svm.core.annotate.TargetClass;
+
+@TargetClass(ThreadedLRUCacheStrategy.class)
+final class ThreadedLRUCacheStrategySubstitutions {
+ @Alias
+ @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias)
+ private static ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread thread = new Thread(r, "LRUCache-Purge-Thread");
+ thread.setDaemon(true);
+ return thread;
+ }
+ });
+}