code: public synchronized void setFinished(final int taskId) {
      final TaskEntity task = getTask(taskId, runningTasks);
      runningTasks.remove(task);
      finishedTasks.add(task);
    }
docs: Update the record of task to mark it as finished.