From: Mateusz Warowny Date: Tue, 5 Apr 2022 12:10:56 +0000 (+0200) Subject: JAL-3878 Add uid to WS Tasks X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=93cf8baeea8bf6cd233ce6b673bcdcf451c0c6d6;p=jalview.git JAL-3878 Add uid to WS Tasks --- diff --git a/src/jalview/ws2/actions/AbstractPollableTask.java b/src/jalview/ws2/actions/AbstractPollableTask.java index 999411f..6ff5749 100644 --- a/src/jalview/ws2/actions/AbstractPollableTask.java +++ b/src/jalview/ws2/actions/AbstractPollableTask.java @@ -11,6 +11,7 @@ import java.util.concurrent.TimeUnit; import jalview.bin.Cache; import jalview.util.ArrayUtils; +import jalview.util.MathUtils; import jalview.ws.params.ArgumentI; import jalview.ws2.actions.api.TaskEventListener; import jalview.ws2.actions.api.TaskI; @@ -37,6 +38,8 @@ import static java.lang.String.format; */ public abstract class AbstractPollableTask implements TaskI { + private final long uid = MathUtils.getUID(); + protected final WebServiceClientI client; protected final List args; @@ -62,6 +65,11 @@ public abstract class AbstractPollableTask implements Task this.eventHandler = new TaskEventSupport(this, eventListener); } + public long getUid() + { + return uid; + } + /** * Start the task using provided scheduled executor service. It creates a * polling loop running at set intervals. diff --git a/src/jalview/ws2/actions/api/TaskI.java b/src/jalview/ws2/actions/api/TaskI.java index 874f5a6..cb84944 100644 --- a/src/jalview/ws2/actions/api/TaskI.java +++ b/src/jalview/ws2/actions/api/TaskI.java @@ -2,9 +2,7 @@ package jalview.ws2.actions.api; import java.util.List; -import jalview.viewmodel.AlignmentViewport; import jalview.ws2.api.JobStatus; -import jalview.ws2.api.WebServiceJobHandle; /** * {@code TaskI} objects represent running services. Tasks are created by @@ -19,6 +17,13 @@ import jalview.ws2.api.WebServiceJobHandle; public interface TaskI { /** + * Get the universal identifier of this task. + * + * @return identifier + */ + long getUid(); + + /** * Get the current status of the task. The resultant status should be a * combination of individual sub-job statuses. *