/** * Records a new task. * * @param task The task itself. It must have an ID field set. */ public synchronized void recordTask(AppFactoryTask task) { long taskId = task.getCurrentTaskState().getId(); mapTaskIdToTask.put(taskId, task); String taskHandle = task.getTaskHandle(); mapTaskHandleToTasks.put(taskHandle, task); }
@Nullable public synchronized TaskState findTaskById(long id) { AppFactoryTask task = mapTaskIdToTask.get(id); if (null == task) { return null; } return task.getCurrentTaskState(); }
@Override public TaskState apply(AppFactoryTask input) { return input.getCurrentTaskState(); }