public interface TaskManager extends AutoCloseable
The base TaskManager interface.
Provides common methods for scheduling tasks for execution and stopping task execution.
| Modifier and Type | Method and Description |
|---|---|
String |
createTask(String taskClassName,
String createdBy,
java.time.Instant runAt,
long period,
mjson.Json 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.
|
TaskStateStorage |
storage()
Return the StateStorage instance that is used by this class.
|
closeString createTask(String taskClassName, String createdBy, java.time.Instant runAt, long period, mjson.Json configuration)
taskClassName - Name of the class implementing the BackgroundTask interface that is to be scheduled for later execution.runAt - Instant 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).TaskManager stopTask(String id, String requesterName)
id - String of task to stop.requesterName - Optional String to denote who requested this call; used for status reporting and may be null.TaskStateStorage storage()
Copyright © 2017 Grakn Labs Ltd. All rights reserved.