@@ -45,8 +45,7 @@ public interface TaskAttachListener {
4545 */
4646 @ MainThread
4747 public abstract Task <?, ?> getTask (@ NonNull String tag );
48-
49-
48+
5049 @ MainThread
5150 public abstract Task <?, ?> attach (@ NonNull String tag , @ NonNull Task .Callback callback );
5251
@@ -71,18 +70,54 @@ public interface TaskAttachListener {
7170 @ MainThread
7271 public abstract Task <?, ?> cancel (@ NonNull String tag );
7372
73+ /**
74+ * Start the given task on the default Executor
75+ * ({@link TaskExecutor#getDefaultExecutor()}). The Task life-cycle events will be delivered to
76+ * the given {@link Task.Callback} listener.
77+ *
78+ * @param task The Task to execute.
79+ * @param callback The Callback listener to deliver the Task events to.
80+ * @see TaskExecutor#setDefaultExecutor(Executor)
81+ */
7482 @ MainThread
7583 public abstract <Progress , Result > void execute (@ NonNull Task <Progress , Result > task , @ NonNull Task .Callback callback );
7684
85+ /**
86+ * Start the given task on {@link Executor}
87+ * ({@link TaskExecutor#setDefaultExecutor(Executor)}). The Task life-cycle events will be
88+ * delivered to the given {@link Task.Callback} listener.
89+ *
90+ * @param task The Task to execute.
91+ * @param callback The Callback listener to deliver the Task events to.
92+ * @param executor The Executor to execute the given Task with.
93+ */
7794 @ MainThread
7895 public abstract <Progress , Result > void execute (@ NonNull Task <Progress , Result > task , @ NonNull Task .Callback callback , @ NonNull Executor executor );
7996
97+ /**
98+ * Checks if the {@link Task} with the given tag has delivered it's result.
99+ * @param tag The tag which identifies the Task to check.
100+ * @return true if the Task did deliver it's result, false if not.
101+ * @see Task#isResultDelivered()
102+ */
80103 @ MainThread
81104 public abstract boolean isResultDelivered (@ NonNull String tag );
82105
106+ /**
107+ * Checks if the {@link Task} with the given tag is running.
108+ * @param tag The tag which identifies the Task to check.
109+ * @return true if the Task is running ({@link Task#doInBackground()} is executing), false if
110+ * not.
111+ * @see Task#isRunning()
112+ */
83113 @ MainThread
84114 public abstract boolean isRunning (@ NonNull String tag );
85115
116+ /**
117+ * Debug use only. Checks if all {@link Task Tasks} added to this TaskManager have been
118+ * detached.
119+ * @throws IllegalStateException if one or more Tasks are not detached.
120+ */
86121 @ MainThread
87122 public abstract void assertAllTasksDetached () throws IllegalStateException ;
88123
0 commit comments