diff options
author | Simon Rettberg | 2019-11-13 17:08:47 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-11-13 17:08:47 +0100 |
commit | 24f8b04fb97e16d9576968db092acf8a8363b0b4 (patch) | |
tree | f8e25da55a94610bcf127cb627ea21b230b55507 | |
parent | [daemon] Better error logging, handling of duplicate UUID (diff) | |
download | taskman-lite-24f8b04fb97e16d9576968db092acf8a8363b0b4.tar.gz taskman-lite-24f8b04fb97e16d9576968db092acf8a8363b0b4.tar.xz taskman-lite-24f8b04fb97e16d9576968db092acf8a8363b0b4.zip |
Add isFinished() to Task
-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. |