| | |
| | | package de.micromata.borgbutler.jobs; |
| | | |
| | | import lombok.AccessLevel; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | |
| | | private boolean stopRequested; |
| | | |
| | | @Getter |
| | | @Setter(AccessLevel.PACKAGE) |
| | | private Status status; |
| | | @Getter |
| | | @Setter |
| | |
| | | @Setter |
| | | private String log; |
| | | |
| | | protected void stopped() { |
| | | this.status = Status.STOPPED; |
| | | /** |
| | | * |
| | | * @return true, if the job is done, stopped or failed. Otherwise false (if job is running or queued). |
| | | */ |
| | | public boolean isFinished() { |
| | | if (status == Status.DONE || status == Status.STOPPED || status == Status.FAILED) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public abstract void execute() throws InterruptedException; |
| | | public abstract void execute(); |
| | | |
| | | /** |
| | | * A job is identified by this id. If a job with the same id is already queued (not yet finished), this job will |
| | | * not be added twice. |
| | | * @return |
| | | */ |
| | | public abstract Object getId(); |
| | | } |