0

i have a service which runs on the javaFX application thread. i want to have a new thread which after 30 second will restart the service, is it possible to access the javaFX application thread from another thread? or have you any suggestion on how i would get around this problem?

Jdavis649
  • 129
  • 1
  • 1
  • 8
  • 1
    have a look at [Java FX modifying UI component state with/without using Platform.runLater](http://stackoverflow.com/questions/26012421/java-fx-modifying-ui-component-state-with-without-using-platform-runlater) – ItachiUchiha Mar 31 '16 at 12:46

1 Answers1

0

If you are using a service you can set up delays for it to start and restart automatically for you.

KeepSessionAliveService service = new KeepSessionAliveService() ;
service.setPeriod(Duration.seconds(30));//repeat every n seconds
service.setDelay(Duration.seconds(30));//Set this only if you want to wait before the service starts

service.setOnSucceeded(event -> {
    //What needs to happen on the ui?
});

service.start();
purring pigeon
  • 4,141
  • 5
  • 35
  • 68