0
private List<Box> listBox = new ArrayList<>();
listBox.add(readAll.exec);

The method readAll.exec executes a thread. The result of the thread arrives about 20 second after the start of execution. Is there a way to syncronize the result of the thread in order to add to the listBox the result when it is ready?

MTCoster
  • 5,868
  • 3
  • 28
  • 49
rugby82
  • 679
  • 1
  • 9
  • 25
  • If `readAll.exec` is a method, did you mean to call it? – MTCoster Feb 13 '19 at 19:02
  • https://stackoverflow.com/questions/44511927/do-i-need-to-use-thread-and-a-task-in-javafx-to-run-something-in-background-when – assylias Feb 13 '19 at 19:13
  • https://stackoverflow.com/questions/22772379/updating-ui-from-different-threads-in-javafx – fabian Feb 13 '19 at 19:21
  • 1
    Are you saying, that you want the new `Box` instance to be added to the `listBox` after the worker thread has done its work? The easiest way would be to have the worker thread itself add the new `Box` to `listBox`. – Solomon Slow Feb 13 '19 at 22:11
  • yes. I want a new Box instance to be added to the listbox after the thread has done its work; and yes to do all inside the thread maybe is the easiest way but i was wondering if it is possible to bind the return value without use a async call back or to make all inside the worker thread. – rugby82 Feb 14 '19 at 08:59

0 Answers0