title: JavaFX: Running a Task in a separate thread doesn't allow anything else to run
body: <p>I need constant data updating in my program, so I thought that through the use of JavaFX's Task that I would be able to have it run as a separate process in my program.</p>
  
  <pre><code>final Task task = new Task&lt;Void&gt;() {
      @Override
      protected Void call() throws Exception {
          Platform.runLater(() -&gt; {
              while (true) {
                  itemData.forEach(data -&gt; {
                      System.out.println(data.getId());
                  });
              }
          });
          return null;
      }
  };
  Thread thread = new Thread(task);
  thread.setDaemon(true);
  thread.start();
  </code></pre>
  
  <p>This is declared in the <code>initialize</code> method provided by the <code>Initializable</code> interface.</p>
  
  <p>When running this program, however, the task is the only thing that runs, even though the task is run on a separate thread. Why would it do this and not run like intended?</p>