public class DistributedTaskManager extends Object implements TaskManager
| Constructor and Description |
|---|
DistributedTaskManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
CompletableFuture |
completableFuture(String taskId)
Return a future that allows registering asynchronous callbacks triggered when a task is completed.
|
static DistributedTaskManager |
getInstance() |
TaskStatus |
getState(String taskID) |
DistributedTaskManager |
open() |
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.
|
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 DistributedTaskManager getInstance()
public DistributedTaskManager open()
open in interface TaskManagerpublic void close()
close in interface AutoCloseablepublic 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 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 TaskManagerpublic CompletableFuture completableFuture(String taskId)
TaskManagercompletableFuture in interface TaskManagertaskId - ID of task to trackpublic TaskStatus getState(String taskID)
Copyright © 2017 Grakn Labs Ltd. All rights reserved.