Guillaume Nodet created CAMEL-24266:
---------------------------------------
Summary: Delayer.delayValue has reverse-direction JMM visibility
gap
Key: CAMEL-24266
URL: https://issues.apache.org/jira/browse/CAMEL-24266
Project: Camel
Issue Type: Improvement
Components: camel-core
Reporter: Guillaume Nodet
Found during review of PR #24985 (CAMEL-24227: volatile sweep for JMX-writable
fields). Like DefaultTracer.traceCounter, this is the reverse direction —
routing threads write while JMX reads.
h3. Problem
{{Delayer.delayValue}} is a plain field that can be written on routing threads
and read over JMX. On 32-bit JVMs, reads of a {{long}} are non-atomic (JLS
17.7), so JMX could observe a torn value.
h3. Suggested fix
Make {{delayValue}} volatile, or use {{AtomicLong}} if read-modify-write
semantics are needed.
h3. References
* PR [#24985|https://github.com/apache/camel/pull/24985] review comment by
oscerd
*
{{core/camel-core-processor/src/main/java/org/apache/camel/processor/Delayer.java}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)