RFR: 8349091: Charts: exception initializing in a background thread [v6]

Andy Goryachev angorya at openjdk.org
Fri Feb 28 18:27:00 UTC 2025


On Wed, 26 Feb 2025 14:34:50 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Andy Goryachev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 25 commits:
>> 
>>  - Merge remote-tracking branch 'origin/master' into 8349091.charts.thread.safety
>>  - review comments
>>  - Merge remote-tracking branch 'origin/master' into 8349091.charts.thread.safety
>>  - Merge remote-tracking branch 'origin/master' into 8349091.charts.thread.safety
>>  - enabled pie chart test
>>  - Merge branch 'master' into 8349091.charts.thread.safety
>>  - Merge branch 'master' into 8349091.charts.thread.safety
>>  - whitespace
>>  - Merge remote-tracking branch 'origin/master' into 8349091.charts.thread.safety
>>  - cleanup
>>  - ... and 15 more: https://git.openjdk.org/jfx/compare/7a7854c9...4288d1d0
>
> modules/javafx.controls/src/main/java/javafx/scene/chart/Chart.java line 106:
> 
>> 104: 
>> 105:     // SimpleBooleanProperty or ObjectBinding
>> 106:     private volatile Object accessibilityActive;
> 
> You can use `ObservableValue<?>` instead of `Object` as the type. Alternatively, use two fields, a `SimpleBooleanProperty` for use by the FX app thread and an ObjectBinding for use by a background thread. They wouldn't need to be volatile in that case. What you have is OK, but using two properties might simplify the logic a bit.

It's a design decision - I won't want to waste an extra pointer.
The cpu cycles are much cheaper nowadays than bytes.
Extra bytes cost much more in cpu cycles (gc) and electricity.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1697#discussion_r1975850728


More information about the openjfx-dev mailing list