I need to execute 3 runnable instance in "serial" in other word, one by one but in the same thread, and get the result.
Currently my code is:
SendCommandTask sendLogReadCommand = new SendCommandTask(methodNameGetLog);
sendLogReadCommand.setOnSucceeded(eventLog -> {
this.LogTemp = ((List<Log>) sendLogReadCommand.getValue()).get(0);
SendCommandTask sendSpaceReadCommand = new SendCommandTask(methodNameGetSpace);
sendSpaceReadCommand.setOnSucceeded(eventSpace -> {
this.boxTemp = ((List<BoxLabellTs>) sendSpaceReadCommand.getValue()).get(0);
SendCommandTask sendAllLabellTssReadCommand = new SendCommandTask(methodNameGetAllLabellTss);
this.listLabellTssTemp = (List<BotLabellTs>) sendAllLabellTssReadCommand.getValue();
this.composeBox();
});
});
Platform.runLater(sendLogReadCommand);
Is there a way to run all with only one Platform.runLater command and get the result of each task?