public class FlightControllerTask extends Task>{
@Override
protected LinkedList call() throws Exception {
// load data
return data;
}
}
// usage:
FlightControllerTask task = new FlightControllerTask();
task.setOnSucceeded(ev -> task.getValue());
new Thread(task).start();
Now the part with task.getValue()
is the crucial part, with this method you can retrieve the value that was computed with the task as soon as is is ready (thus the succeeded hook).