RFR: 8324658: Allow animation play/start/stop/pause methods to be called on any thread [v2]

Nir Lisker nlisker at openjdk.org
Sat Jan 27 15:53:38 UTC 2024


On Sat, 27 Jan 2024 15:40:53 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Nir Lisker has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Doc changes to AnimationTimer methods
>
> modules/javafx.graphics/src/main/java/javafx/animation/Timeline.java line 196:
> 
>> 194:     @Override
>> 195:     void stopOnFxThread() {
>> 196:         // The parent check is redone in the super method. Consider refactoring.
> 
> As you've probably already seen, this causes infinite recursion and an eventual StackOverflow. The easiest (and probably safest) fix is to revert this part of the change, keeping the overridden `stop` method, and have it call a private `stopOnFxThread` method (and make the one in the parent class also private). You can file a bug to refactor it later.

I just pushed a fix that calls the correct super method. The implementation isn't fully tested yet because I wanted to get the CSR moving in parallel.

I'm still thinking on the least intrusive way to write the tests. It seems that the only way to check if a method runs on the FX thread is to override a method on its stack and check there. That means that I would need to expose (package-private) the `play/start/stop/pauseOnFxThread` methods.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1352#discussion_r1468511221


More information about the openjfx-dev mailing list