RFR: 8348423: [TestBug] stress test Nodes initialization from a background thread

Andy Goryachev angorya at openjdk.org
Fri Jan 31 20:15:09 UTC 2025


On Fri, 31 Jan 2025 19:36:02 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Created a test that validates various Nodes can be initialized in a background thread.
>
> tests/system/src/test/java/test/robot/javafx/scene/NodeInitializationBackgroundThreadTest.java line 779:
> 
>> 777: 
>> 778:     private static boolean nextBoolean() {
>> 779:         return new Random().nextBoolean();
> 
> It is a best practice when using Random to share a single instance and not allocate a new one each time. It is more performant and more random.

while true, the shared instance will add synchronization and this is something I would like to avoid.  The degree of randomness is not that important in this case.

the only thing that we lose is reproducibility, but in the case of a headful test it's probably impossible anyway, due to many other factors.

In any case, I think the main purpose of this test is a sort of sanity check of the requirement, not an exhaustive test of all the properties and all the methods that the application can call from a background thread - at least that what I thought at the time of writing.  We can always add more stress to it.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1690#discussion_r1937935407


More information about the openjfx-dev mailing list