Luigi Scarminio
08/03/2022, 2:44 PMArkadii Ivanov
08/03/2022, 3:07 PMScheduler
by using Platform.runLater
. For delayed operations you can post to a thread pool and then again use runLater
. Just be careful with cancellations - a cancelled Executor
must not call any previously submitted callbacks. I could create an example if needed.
Alternatively, you can use kotlinx-coroutines-javafx and Reaktive coroutines-interop
modules and do as follows:
val uiScheduler = Dispatchers.Main.asScheduler()
Luigi Scarminio
08/03/2022, 8:38 PMExecutors.newScheduledThreadPool(1) { runnable ->
Thread(runnable).apply {
isDaemon = true
}
}
The tasks from submit() and submitRepeating() were wrapped using Platform.runLater.
Something like this?Arkadii Ivanov
08/03/2022, 10:03 PMScheduler.Executor
is cancelled/disposed, none of its scheduled tasks hould be ever executed.