title: UI updates are getting blocked by future.get() in javafx
body: <p>I have a function which is supposed to return a list from the result of a Task API.</p>
  
  <pre><code>    @Override
      public List performQuery(boolean isPaginationQuery, boolean isSortingQuery {
  
          try {
              TaskImpl taskImpl = new TaskImpl(isPaginationQuery,
                      isSortingQuery);
              queryExecutor.submit(taskImpl).get();
              return taskImpl.get();
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  </code></pre>
  
  <p>Inner class which performs the updates</p>
  
  <pre><code>private class TaskImpl extends Task&lt;List&gt; {
  
          private boolean isPaginationQuery, isSortingQuery;
  
          public TaskImpl(boolean isPaginationQuery, boolean isSortingQuery) {
              this.isPaginationQuery = isPaginationQuery;
              this.isSortingQuery = isSortingQuery;
          }
  
          @Override
          protected List call() throws Exception {
               Platform.runLater(() -&gt; {
                    loaderContainer.setVisible(true);
                    loaderContainer.toFront();
               });
  
              HSession hSession = new HSession();
              TaskInfoDao taskInfoDao = new TaskInfoDaoImpl(hSession.getSession(), currentConnection.getConnectionId());
              if (!isPaginationQuery &amp;&amp; !isSortingQuery) {
                  paginator.setTotal(taskInfoDao.getTaskInfoWithFiltersCount(paginator.getFilterMap(), false));
              }
              Stream&lt;TaskInfo&gt; resultStream = taskInfoDao.getTaskInfoWithFilters(paginator.getFilterMap(), false,
                      paginator.getStartIndex() * paginator.getPageSize(),
                      paginator.getPageSize() * paginator.getPageGap());
              List&lt;TaskInfoTableView&gt; data = createData(resultStream);
              hSession.close();
              return data;
          }
  
          @Override
          protected void succeeded() {
              super.succeeded();
  
              try {
                  //set the pagination if the task is complete
                  //and it is not a pagination query
                  if (!isPaginationQuery) {
                      ((TaskInfoViewController) uiController).setPagination(
                              FXCollections.observableArrayList(get()));
                  }
              } catch (InterruptedException | ExecutionException e) {
                  e.printStackTrace();
              }
          }
  
          @Override
          protected void cancelled() {
              super.cancelled();
              updateMessage("Cancelled!");
          }
  
          @Override
          protected void failed() {
              super.failed();
              updateMessage("Failed!");
          }
      }
  </code></pre>
  
  <p>performQuery function calls the thread and waits for its result.<br/><br/>
  The loader is being displayed from inside the TaskImpl class using Platform.runLater.<br/>
  But the loader does not appear until the task has finished i.e. loader appears after the completion of call() function's execution.<br/><br/>
  When i remove the taskImpl.get() the loader works fine.<br/>
  <br/>
  Any help is appreciated.</p>
  
  <p>P.S. : Under any case, I need the result of the Task API outside the Inner class( outside TaskImpl )</p>