public abstract class MockBackgroundTask extends BackgroundTask
| Modifier and Type | Field and Description |
|---|---|
protected AtomicBoolean |
cancelled |
protected Object |
sync |
| Constructor and Description |
|---|
MockBackgroundTask() |
| Modifier and Type | Method and Description |
|---|---|
static com.google.common.collect.ImmutableMultiset<TaskId> |
cancelledTasks() |
static void |
clearTasks() |
static com.google.common.collect.ImmutableMultiset<TaskId> |
completedTasks() |
protected abstract void |
executeResumeInner(TaskCheckpoint checkpoint) |
protected abstract void |
executeStartInner(TaskId id) |
boolean |
resume(TaskCheckpoint lastCheckpoint)
This method may be called when resuming from a paused state or recovering from a crash or failure of any kind.
|
boolean |
start()
Called to start execution of the task, may be called on a newly scheduled or previously stopped task.
|
boolean |
stop()
Called to stop execution of the task, may be called on a running or paused task.
|
static void |
whenTaskFinishes(java.util.function.Consumer<TaskId> onTaskFinish) |
static void |
whenTaskResumes(java.util.function.Consumer<TaskCheckpoint> onTaskResume) |
static void |
whenTaskStarts(java.util.function.Consumer<TaskId> beforeTaskStarts) |
addTask, configuration, engineConfiguration, factory, initialize, pause, redis, saveCheckpointprotected final AtomicBoolean cancelled
protected final Object sync
public static com.google.common.collect.ImmutableMultiset<TaskId> completedTasks()
public static com.google.common.collect.ImmutableMultiset<TaskId> cancelledTasks()
public static void whenTaskStarts(java.util.function.Consumer<TaskId> beforeTaskStarts)
public static void whenTaskFinishes(java.util.function.Consumer<TaskId> onTaskFinish)
public static void whenTaskResumes(java.util.function.Consumer<TaskCheckpoint> onTaskResume)
public static void clearTasks()
public final boolean start()
BackgroundTaskstart in class BackgroundTaskpublic final boolean stop()
BackgroundTask
This implementation always throws UnsupportedOperationException.
stop in class BackgroundTaskpublic final boolean resume(TaskCheckpoint lastCheckpoint)
BackgroundTask
This implementation always throws UnsupportedOperationException.
resume in class BackgroundTasklastCheckpoint - The last checkpoint as sent to saveCheckpoint.protected abstract void executeStartInner(TaskId id)
protected abstract void executeResumeInner(TaskCheckpoint checkpoint)
Copyright © 2017 Grakn Labs Ltd. All rights reserved.