| | |
| | | import lombok.AccessLevel; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | public abstract class AbstractJob { |
| | | private Logger logger = LoggerFactory.getLogger(AbstractJob.class); |
| | | public enum Status {DONE, RUNNING, QUEUED, STOPPED, FAILED} |
| | | @Getter |
| | | @Setter |
| | |
| | | @Getter |
| | | @Setter |
| | | private String statusText; |
| | | @Getter |
| | | @Setter |
| | | private String log; |
| | | |
| | | protected void failed() { |
| | | if (this.status != Status.RUNNING) { |
| | | logger.error("Internal error, illegal state! You shouldn't set the job status to FAILED if not in status RUNNING: " + this.status); |
| | | } |
| | | this.status = Status.FAILED; |
| | | } |
| | | /** |
| | | * |
| | | * @return true, if the job is done, stopped or failed. Otherwise false (if job is running or queued). |