[
https://issues.apache.org/jira/browse/CAMEL-24685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-24685 started by Federico Mariani.
------------------------------------------------
> camel-joor - an inline expression with preCompile=false compiles on every
> evaluation
> ------------------------------------------------------------------------------------
>
> Key: CAMEL-24685
> URL: https://issues.apache.org/jira/browse/CAMEL-24685
> Project: Camel
> Issue Type: Bug
> Components: camel-joor
> Affects Versions: 4.22.0
> Reporter: Federico Mariani
> Assignee: Federico Mariani
> Priority: Major
>
> {{JoorExpression.evaluate}} does
> {code:java}
> JoorMethod target = this.method;
> if (target == null) {
> target = compiler.compile(exchange.getContext(), text, singleQuotes);
> }
> {code}
> and never stores {{target}}, so with {{preCompile=false}} every exchange runs
> javac and defines a new class (and class loader). The default
> {{preCompile=true}} is unaffected.
> Note that {{preCompile=false}} with a {{resource:file:}} script is the
> documented hot re-load mode ({{JoorPreCompileFalseTest}} rewrites the file
> mid-test), so the recompilation must be kept for resource scripts. Proposed
> fix (implemented, tested): compile inline scripts
> ({{!ScriptHelper.hasExternalScript(text)}}) once lazily into a volatile
> field, keep recompiling resource scripts, and clarify the joor/java language
> docs. A new test sends two messages through a {{preCompile=false}} inline
> expression and asserts one compilation.
> ----
> _Found during a benchmark review of camel-groovy and the other scripting
> languages (camel-performance-tests branch camel-groovy-perf,
> tests/camel-jmh/groovy-results, JMH 1.37, JDK 21, one M1 Pro laptop). A
> candidate fix with tests exists on the local apache/camel branch
> camel-perf-all-fixes; a PR follows._
> _Claude Code on behalf of Croway_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)