code: public <T> Future<T> addTask(String title,
                                   long total,
                                   ProgressHandler<T> handler) {
          ProgressAsyncHandler<T> async = (result, progress) -> {
              try {
                  result.complete(handler.handle(progress));
              } catch (Exception e) {
                  if (!result.isCancelled()) {
                      result.completeExceptionally(e);
                  }
              }
          };
          return addTask(title, total, async);
      }
docs: Add a task to be done while showing progress. If there are too many tasks
  ongoing, the task will be queued and done when the local thread pool has
  available threads.
  
  @param title The progress title of the task.
  @param total The total progress to complete.
  @param handler The handler to do the task behind the progress being shown.
  @param <T> The return type for the task.
  @return The future returning the task result.