RFR: 8349091: Charts: exception initializing in a background thread
Andy Goryachev
angorya at openjdk.org
Thu Feb 6 19:53:45 UTC 2025
Root Cause:
(Multiple) properties are getting bound to the global `Platform.accessibilityActive` property. Binding (and I say, accessing) of properties is not thread-safe.
I also changed the design a bit. Originally, every symbol in a chart had its `focusTraversableProperty` bound to `Platform.accessibilityActive` in order to enable the accessibility navigation across the chart data points. This is rather inefficient, as the property has to manage (thousands?) of listeners.
Instead, a single boolean property is added to each chart, with a listener added to it which iterates over data symbols to toggle the `focusTraversableProperty` directly.
The exact moment when the new property gets bound is also important, and has to happen in the FX application thread.
With this change, it is safe to create and populate charts with data in a background thread.
---
## NOTES
1. It looks like the `Platform.accessibilityActive` property never transitions back to false after it transitioned to true. Some say it is because there is no mechanism in the platform to get notified which cannot possibly be true.
2. The javadoc for `Platform.accessibilityActiveProperty()` method stipulates that "_This method may be called from any thread_" which is patently not true as the current implementation is simply not thread-safe.
-------------
Commit messages:
- whitespace
- Merge remote-tracking branch 'origin/master' into 8349091.charts.thread.safety
- cleanup
- tests pass
- chart tests only
- more jitter
- Merge remote-tracking branch 'origin/master' into 8348423.node.thread.safety
- skip tests
- jiggler
- better name
- ... and 8 more: https://git.openjdk.org/jfx/compare/d615fdc7...4070d8cc
Changes: https://git.openjdk.org/jfx/pull/1697/files
Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1697&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8349091
Stats: 304 lines in 11 files changed: 165 ins; 100 del; 39 mod
Patch: https://git.openjdk.org/jfx/pull/1697.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1697/head:pull/1697
PR: https://git.openjdk.org/jfx/pull/1697
More information about the openjfx-dev
mailing list