diff options
-rw-r--r-- | api/src/main/java/org/openslx/taskmanager/api/AbstractTask.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/api/src/main/java/org/openslx/taskmanager/api/AbstractTask.java b/api/src/main/java/org/openslx/taskmanager/api/AbstractTask.java index d284ecf..4586c3d 100644 --- a/api/src/main/java/org/openslx/taskmanager/api/AbstractTask.java +++ b/api/src/main/java/org/openslx/taskmanager/api/AbstractTask.java @@ -287,6 +287,19 @@ public abstract class AbstractTask implements Runnable return false; return this.removalDeadline != 0 && System.currentTimeMillis() > this.removalDeadline; } + + /** + * Check whether the given task is finished, i.e. either failed or succeeded, + * or couldn't be started because its parent failed, + * but is not running or still waiting for execution. + * + * @return true if task finished running or was not able to start + */ + public final boolean isFinished() + { + StatusCode sc = getStatusCode(); + return sc != StatusCode.TASK_WAITING && sc != StatusCode.TASK_PROCESSING; + } /** * Execute the task, wrapped in some sanity checks. |