use of com.baidu.hugegraph.entity.enums.LoadStatus in project incubator-hugegraph-toolchain by apache.
the class LoadTaskService method stop.
public LoadTask stop(int taskId) {
LoadTask task = this.runningTaskContainer.get(taskId);
if (task == null) {
task = this.get(taskId);
}
LoadStatus status = task.getStatus();
Ex.check(status == LoadStatus.RUNNING || status == LoadStatus.PAUSED, "Can only stop the RUNNING or PAUSED task");
// Mark status as stopped
task.setStatus(LoadStatus.STOPPED);
if (status == LoadStatus.RUNNING) {
task.stop();
}
task.lock();
try {
this.update(task);
this.runningTaskContainer.remove(taskId);
} finally {
task.unlock();
}
return task;
}
Aggregations