You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "davsclaus (via GitHub)" <gi...@apache.org> on 2026/10/12 11:42:23 UTC
[PR] chore: camel-jbang - timers and animations use a monotonic clock, not the wall clock [camel]
davsclaus opened a new pull request, #27720:
URL: https://github.com/apache/camel/pull/27720
The camel-jbang TUI timed its durations, deadlines, refresh intervals and animations with the wall clock (`System.currentTimeMillis()`). The wall clock can be set back or forward (an NTP step, a manual change, a VM resume). A timer measured with it then freezes until the clock catches up, or fires at once. They now run on `MonotonicClock.millis()`, a small package-private helper that reads `System.nanoTime()`.
This prepares the TamboUI 0.6 upgrade, [CAMEL-25580](https://issues.apache.org/jira/browse/CAMEL-25580). TamboUI makes the same move in [tamboui/tamboui#548](https://github.com/tamboui/tamboui/pull/548): `TickEvent.elapsed()` is removed and effects are timed with a monotonic render clock. The TUI does not call `TickEvent.elapsed()`.
`MonotonicClock` compares `nanoTime` values only by their difference. It starts a day in, so a time field still at 0 (never set) reads as long ago, as it did on the wall clock. Times that pass between classes state their clock where they are declared: `PendingKey.fireAt`, `IntegrationInfo.startingSince` and `vanishStart`, `KeyRecord.pressedAt` (renamed from `timestamp`), and the `tick(now)` methods. `CaptionOverlay` takes a clock for tests, as `EditReplay` already does.
131 of the 147 `currentTimeMillis()` calls (in 31 files) became monotonic. The other 16 (in 6 files) stay on the wall clock:
| Clock | What | Why |
|---|---|---|
| Monotonic | Durations ("thinking 12s"; LLM, tool, HTTP and confirm-wait times), deadlines and timeouts (MCP tool waits, launch and infra watch, JFR results poll), refresh, throttle and cache intervals, locally measured rates (throughput sparklines, CPU load, Ollama decode and prefill), animations and overlays (captions, drawings, notifications, vanishing rows, spinners, recent keys, edit replay), MCP pending keys and tape sleeps | Only the time between two moments in this TUI matters |
| Wall clock | Memory leak recording start and end, JFR snapshot age | Epoch times from the integration's JFR status |
| Wall clock | Activity rate and time filter, "since last" exchange, internal task "next" | Exchange and task times from the integration |
| Wall clock | Overview `uptimeMillis` | The process start time from its status file |
| Wall clock | Ollama `lastPoll`, slot and host `sampledAt`, a question's start time (`Instant.now()`) | Shown or exported as a time of day |
### Tests
- `MonotonicClockTest`: the clock never goes back, it moves on with the time that passes (Awaitility, no sleep), and a time never set reads as long ago.
- `MonotonicTimersTest`: a pending MCP key fires on time, a caption expires on its (fake) clock, and a drawing expires on time. Their times are far from any wall-clock time, so a timer that reads the wall clock fires at once or never. Putting `currentTimeMillis()` back into `McpFacade.injectKeys` or `DrawOverlay` makes them fail.
- Tests that pass times into converted code now use `MonotonicClock.millis()`. The two `Thread.sleep` polling loops in `LaunchManagerInfraTest` now use Awaitility.
- In the module, `mvn test` passes (1907 tests, 1 skipped), and so does `mvn -Psourcecheck verify -DskipTests`.
_Claude Code on behalf of davsclaus_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang - timers and animations use a monotonic clock, not the wall clock [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27720:
URL: https://github.com/apache/camel/pull/27720#issuecomment-6123578328
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang - timers and animations use a monotonic clock, not the wall clock [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27720:
URL: https://github.com/apache/camel/pull/27720#issuecomment-6124810852
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `dsl/camel-jbang/camel-jbang-plugin-tui`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 2 of 704 tested, 1 compile-only — current: 2 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **2 affected modules** (current approach: 2).
**Skip-tests mode would test 2 modules** (1 direct + 1 downstream), **skip tests for 1** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (2)</summary>
- `camel-jbang-plugin-tui` ← dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ActionsPopup.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ArchitectureView.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CaptionOverlay.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DataRefreshService.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DrawOverlay.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/EditReplay.java, dsl/camel-jbang/camel-jb
ang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/HttpHelper.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/InfraInfo.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/IntegrationInfo.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/IntegrationSummaryHints.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/LaunchManager.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/McpFacade.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MemoryLeakTab.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MetricsCollector.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl
/jbang/core/commands/tui/MonitorContext.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MonotonicClock.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OllamaMonitor.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OllamaTab.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ProjectOverviewAssist.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RecordingManager.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteGroups.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteKeys.java, dsl/cam
el-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RunOptionsForm.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceEditAssist.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceTab.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TapeRecorder.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ThreadsTab.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiHelper.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiMcpServer.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/
dsl/jbang/core/commands/tui/TuiToolRegistry.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanelTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/LaunchManagerInfraTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonotonicClockTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/MonotonicTimersTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/OllamaMonitorTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/OpenedProjectLifecycleTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/RecordingManagerTest.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang
/core/commands/tui/RunOptionsFormTest.java
- `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
</details>
<details><summary>Modules with tests skipped (1)</summary>
- `camel-launcher`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
<details><summary>All tested modules (3 modules, 38.0s total)</summary>
**Total reactor time:** 38.0s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: Launcher | 37.1s | SUCCESS |
| Camel :: Launcher :: Container | 0.8s | SUCCESS |
| Camel :: JBang :: Plugin :: TUI | n/a | |
**Top 20 slowest modules:**
- `Camel :: Launcher` (37.1s)
- `Camel :: Launcher :: Container` (0.8s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/38244377869)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang - timers and animations use a monotonic clock, not the wall clock [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27720:
URL: https://github.com/apache/camel/pull/27720
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org