i wrote a small application, which among other things makes a REST call to a JIRA REST API do download issues. I have a progress bar indicating the progress of the download. However, actually i need to make two REST calls. The first one needs to finished before the second one starts. Between them i need to update the UI.
Below is some example code:
// Loads the dialog from the fxml file and shows it
@FXML
public void showProgressDialog() {
mainApp.showDownloadProgressDialog();
}
// Retrieves some meta information
public void firstDownload() {
Task<Void> task = new Task<Void>() {
@Override
public Void call() {
// do something
}
};
new Thread(task).start();
}
// Do some UI update
// Retrieves the actual issues
public void secondDownload() {
Task<Void> task = new Task<Void>() {
@Override
public Void call() {
for (int i = 0; i < limit; i++) {
// so something
updateProgress((double) i / (double) limit, max);
}
}
};
new Thread(task).start();
}
// Do some UI update
How can i ensure that all functionality shown above is executed in exactly this order?
Thanks for any help!