@Test public void createLocalTaskAfter11Minutes() { testSubject.createTask("DummyHandler", new UserInfo("user", Collections.emptySet()), Duration.ofMinutes(11)); assertEquals(1, tasks.size()); assertEquals(1, scheduler.tasks()); scheduler.timeElapses(5, TimeUnit.MINUTES); assertEquals(1, tasks.size()); assertEquals(2, scheduler.tasks()); scheduler.timeElapses(6, TimeUnit.MINUTES); assertEquals(0, tasks.size()); assertEquals(1, scheduler.tasks()); assertEquals(1, executionCounter.get()); }
public String createTask(String taskHandler, TaskPayload payload, long instant) { Task task = new Task(); task.setTaskId(UUID.randomUUID().toString()); task.setStatus(TaskStatus.SCHEDULED); task.setTimestamp(instant); task.setTaskExecutor(taskHandler); task.setContext(context); task.setPayload(payload); super.saveAndSchedule(task); return task.getTaskId(); }
StandaloneTaskManager extends BaseTaskManager { public String createTask(String taskHandler, TaskPayload payload, long instant) { Task task = new Task(); task.setTaskId(UUID.randomUUID().toString()); task.setStatus(TaskStatus.SCHEDULED); task.setTimestamp(instant); task.setTaskExecutor(taskHandler); task.setContext(context); task.setPayload(payload); super.saveAndSchedule(task); return task.getTaskId(); } }
StandaloneTaskManager extends BaseTaskManager { public String createTask(String taskHandler, TaskPayload payload, long instant) { Task task = new Task(); task.setTaskId(UUID.randomUUID().toString()); task.setStatus(TaskStatus.SCHEDULED); task.setTimestamp(instant); task.setTaskExecutor(taskHandler); task.setContext(context); task.setPayload(payload); super.saveAndSchedule(task); return task.getTaskId(); } StandaloneTaskManager(String context,
                                 ScheduledTaskExecutor taskExecutor,
                                 TaskRepository taskRepository,
                                 TaskPayloadSerializer taskPayloadSerializer,
                                 PlatformTransactionManager platformTransactionManager,
                                 @Qualifier("taskScheduler") ScheduledExecutorService scheduler,
                                 Clock clock); }
StandaloneTaskManager extends BaseTaskManager { public String createTask(String taskHandler, TaskPayload payload, long instant) { Task task = new Task(); task.setTaskId(UUID.randomUUID().toString()); task.setStatus(TaskStatus.SCHEDULED); task.setTimestamp(instant); task.setTaskExecutor(taskHandler); task.setContext(context); task.setPayload(payload); super.saveAndSchedule(task); return task.getTaskId(); } StandaloneTaskManager(String context,
                                 ScheduledTaskExecutor taskExecutor,
                                 TaskRepository taskRepository,
                                 TaskPayloadSerializer taskPayloadSerializer,
                                 PlatformTransactionManager platformTransactionManager,
                                 @Qualifier("taskScheduler") ScheduledExecutorService scheduler,
                                 Clock clock); String createTask(String taskHandler, TaskPayload payload, long instant); void createTask(String taskHandler, Object payload, Duration delay); void cancel(String taskId); }
StandaloneTaskManager extends BaseTaskManager { public String createTask(String taskHandler, TaskPayload payload, long instant) { Task task = new Task(); task.setTaskId(UUID.randomUUID().toString()); task.setStatus(TaskStatus.SCHEDULED); task.setTimestamp(instant); task.setTaskExecutor(taskHandler); task.setContext(context); task.setPayload(payload); super.saveAndSchedule(task); return task.getTaskId(); } StandaloneTaskManager(String context,
                                 ScheduledTaskExecutor taskExecutor,
                                 TaskRepository taskRepository,
                                 TaskPayloadSerializer taskPayloadSerializer,
                                 PlatformTransactionManager platformTransactionManager,
                                 @Qualifier("taskScheduler") ScheduledExecutorService scheduler,
                                 Clock clock); String createTask(String taskHandler, TaskPayload payload, long instant); void createTask(String taskHandler, Object payload, Duration delay); void cancel(String taskId);  }