-
Enhancement
-
Resolution: Duplicate
-
P4
-
fx2.1
-
All
To implement a periodic execution of Tasks you have currently to manually restart a service with registering a listener:
Service<...> service;
service.stateProperty().addListener(new ChangeListener<Worker.State>() {
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldState, Worker.State newState) {
if (newState.equals(Worker.State.SUCCEEDED) || newState.equals(Worker.State.FAILED)) {
service.reset();
service.start();
}
}
});
An out-of-the-box support for polling in javafx.concurrent.Service is appreciated: long-pooling of RESTful services is a common practice for the implementation of server push.
Service<...> service;
service.stateProperty().addListener(new ChangeListener<Worker.State>() {
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldState, Worker.State newState) {
if (newState.equals(Worker.State.SUCCEEDED) || newState.equals(Worker.State.FAILED)) {
service.reset();
service.start();
}
}
});
An out-of-the-box support for polling in javafx.concurrent.Service is appreciated: long-pooling of RESTful services is a common practice for the implementation of server push.