RFR: 8375561: Class NGGroup is in need of some cleanup [v4]

Kevin Rushforth kcr at openjdk.org
Mon Jan 26 17:20:46 UTC 2026


On Mon, 26 Jan 2026 16:30:50 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Christopher Schnick has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove unused imports
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/sg/prism/NGGroup.java line 218:
> 
>> 216:         for (int i = (startPos == -1 ? 0 : startPos); i < orderedChildren.size(); i++) {
>> 217:             NGNode child = orderedChildren.get(i);
>> 218:             child.render(g);
> 
> more on the concurrency here: if one would instrument the get(int) method in `children`  like so
> 
> 
>     private final List<NGNode> children = new ArrayList<>(1) {
>         public NGNode get(int ix) {
>             System.out.println(Thread.currentThread());
>             return super.get(ix);
>         }
>     };
> 
> 
> the log will show accesses from two threads:
> 
> 
> Thread[#33,JavaFX Application Thread,5,main]
> ...
> Thread[#28,QuantumRenderer-0,5,main]
> ...
> Thread[#33,JavaFX Application Thread,5,main]
> 
> 
> The access pattern for `viewOrderChildren` seem to show only QuantumRenderer thread, though I did not test extensively.
> 
> Does anyone know if these two threads are allowed to run in parallel, or is there a mechanism in place that ensures mutual exclusion?

Yes, this is expected. No, the threads do not run in parallel. The renderLock mechanism prevents it. The only access from the JavaFX Application thread is while holding the render lock to update the render graph (NG* nodes) from the scene graph.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2043#discussion_r2728511729


More information about the openjfx-dev mailing list