org.embulk.spi.TaskState Maven / Gradle / Ivy
package org.embulk.spi;
import com.google.common.base.Optional;
import org.embulk.config.TaskReport;
public class TaskState {
private volatile boolean started = false;
private volatile boolean finished = false;
private volatile Optional taskReport = Optional.absent();
private volatile Optional exception = Optional.absent();
public void start() {
this.started = true;
}
public void finish() {
this.started = true;
this.finished = true;
}
public void setTaskReport(TaskReport taskReport) {
this.started = true;
this.taskReport = Optional.of(taskReport);
}
public void setException(Throwable exception) {
this.started = true;
this.exception = Optional.fromNullable(exception);
}
public void resetException() {
this.started = true;
this.exception = Optional.absent();
}
public boolean isStarted() {
return started;
}
public boolean isFinished() {
return finished;
}
public boolean isCommitted() {
return taskReport.isPresent();
}
public Optional getTaskReport() {
return taskReport;
}
public Optional getException() {
return exception;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy