Claus Ibsen created CAMEL-27730:
-----------------------------------
Summary: camel-timer: fixedRate with period <= 0 fails the start,
runLoggingLevel=OFF logs at TRACE
Key: CAMEL-27730
URL: https://issues.apache.org/jira/browse/CAMEL-27730
Project: Camel
Issue Type: Bug
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-timer for CAMEL-23832
(commit
https://github.com/apache/camel/commit/9f28c66540fab3de1e18fd2af9498fae8703a2b8).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. fixedRate=true with a period of 0 or less fails the route start
{{TimerConsumer.configureTask()}} calls
{{java.util.Timer.scheduleAtFixedRate(task, delay, period)}} (or the variant
with the {{time}} option) whenever {{fixedRate=true}}, without looking at the
period. {{Timer.scheduleAtFixedRate}} throws {{IllegalArgumentException}} when
the period is 0 or negative, so for example
{{timer:foo?fixedRate=true&period=0}} fails when the consumer starts (from
{{doStart()}} or {{onCamelContextStarted()}}). Without {{fixedRate}} the same
period fires once, as {{configureTask()}} then calls {{Timer.schedule(task,
delay)}}.
Proposed change: treat a period of 0 or less as a single fire also with
{{fixedRate=true}}, or reject the combination in {{TimerEndpoint.doInit()}}
with a clear message.
h4. 2. runLoggingLevel=OFF still logs at TRACE
The {{TimerTask.run()}} created in {{TimerConsumer.doInit()}} picks the log
level of the "Timer task started on" and "Timer task completed on" lines with
an if/else chain for ERROR, WARN, INFO and DEBUG. Every other value, {{OFF}}
included, falls into the {{else}} branch, which logs at TRACE. So
{{runLoggingLevel=OFF}} does not turn the lines off when TRACE is enabled for
{{TimerConsumer}}.
Proposed change: do not log the two lines when the level is {{OFF}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)