When restart()ing a ScheduledService while having assertions enabled, the 
assertions in [1] or [2] fail. Without assertions the code seems to run fine, 
though.

According to the inline comments, "resetting things should have cleared the 
delayTask". Therefore I wonder, if resetting the delayTask is missing in 
reset().

At the moment this field is only set to null during cancel() [3] as well as 
after exception-free execution of a previous TimerTask [4].

A workaround would be to call cancel() first, but one has to make sure to be in 
a valid state. I wonder if there is some documentation about the state 
transitions and how to start, stop and restart a service correctly.


[1]: 
https://github.com/openjdk/jfx/blob/e98645932d0d7765988f21b09d6d121202281e02/modules/javafx.graphics/src/main/java/javafx/concurrent/ScheduledService.java#L357
 
<https://github.com/openjdk/jfx/blob/e98645932d0d7765988f21b09d6d121202281e02/modules/javafx.graphics/src/main/java/javafx/concurrent/ScheduledService.java#L357>
[2]: 
https://github.com/openjdk/jfx/blob/e98645932d0d7765988f21b09d6d121202281e02/modules/javafx.graphics/src/main/java/javafx/concurrent/ScheduledService.java#L379
 
<https://github.com/openjdk/jfx/blob/e98645932d0d7765988f21b09d6d121202281e02/modules/javafx.graphics/src/main/java/javafx/concurrent/ScheduledService.java#L379>
[3]: 
https://github.com/openjdk/jfx/blob/e98645932d0d7765988f21b09d6d121202281e02/modules/javafx.graphics/src/main/java/javafx/concurrent/ScheduledService.java#L469
 
<https://github.com/openjdk/jfx/blob/e98645932d0d7765988f21b09d6d121202281e02/modules/javafx.graphics/src/main/java/javafx/concurrent/ScheduledService.java#L469>
[4]: 
https://github.com/openjdk/jfx/blob/e98645932d0d7765988f21b09d6d121202281e02/modules/javafx.graphics/src/main/java/javafx/concurrent/ScheduledService.java#L524
 
<https://github.com/openjdk/jfx/blob/e98645932d0d7765988f21b09d6d121202281e02/modules/javafx.graphics/src/main/java/javafx/concurrent/ScheduledService.java#L524>

Reply via email to