davsclaus commented on code in PR #26306:
URL: https://github.com/apache/camel/pull/26306#discussion_r3989793719
##########
components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorCompiler.java:
##########
@@ -81,6 +81,13 @@ public Map<String, String> getAliases() {
return aliases;
}
+ /**
+ * Number of scripts this compiler has compiled so far.
+ */
+ public int getCounter() {
Review Comment:
Two small things about exposing this.
`JoorPreCompileFalseInlineTest` lives in `org.apache.camel.language.joor`,
the same package as `JoorCompiler`, so a package-private accessor gets the test
what it needs without growing the public surface of a component class.
CLAUDE.md is strict about public API and this is only needed for a test.
Second, `counter` is a plain `int` incremented in `compile(...)` with no
synchronisation. That was already true and only fed a debug log, so it did not
matter; a public getter makes it look like a reliable number. Concurrent
compiles of *different* expressions can lose an increment, so a caller could
see a count lower than the number of compiles. Either make it an
`AtomicInteger` or say in the javadoc that it is approximate and intended for
diagnostics.
(The test itself is fine as written — `MockEndpoint.assertIsSatisfied` gives
the happens-before, and only one expression is compiling.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]