public class InMemoryTaskManager extends Object implements TaskManager
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture |
completableFuture(String taskId)
Return a future that allows registering asynchronous callbacks triggered when a task is completed.
|
static InMemoryTaskManager |
getInstance() |
String |
scheduleTask(BackgroundTask task,
String createdBy,
Date runAt,
long period,
org.json.JSONObject configuration)
Schedule a single shot/one off BackgroundTask to run after a @delay in milliseconds.
|
void |
shutdown() |
TaskManager |
stopTask(String id,
String requesterName)
Stop a Scheduled, Paused or Running task.
|
StateStorage |
storage()
Return the StateStorage instance that is used by this class.
|
public static InMemoryTaskManager getInstance()
public void shutdown()
public String scheduleTask(BackgroundTask task, String createdBy, Date runAt, long period, org.json.JSONObject configuration)
TaskManagerscheduleTask in interface TaskManagertask - Any object implementing the BackgroundTask interface that is to be scheduled for later execution.runAt - Date when task should run.period - A non-zero value indicates that this should be a recurring task and period indicates the delay between
subsequent runs of the task after successful execution.configuration - A JSONObject instance containing configuration and optionally data for the task. This is an
optional parameter and may be set to null to not pass any configuration (task.start() will
get an initialised but empty JSONObject).public CompletableFuture completableFuture(String taskId)
TaskManagercompletableFuture in interface TaskManagertaskId - ID of task to trackpublic TaskManager stopTask(String id, String requesterName)
TaskManagerstopTask in interface TaskManagerid - String of task to stop.requesterName - Optional String to denote who requested this call; used for status reporting and may be null.public StateStorage storage()
TaskManagerstorage in interface TaskManagerCopyright © 2016 Grakn Labs Ltd. All rights reserved.