@@ -45,8 +45,7 @@ public interface TaskAttachListener {
45
45
*/
46
46
@ MainThread
47
47
public abstract Task <?, ?> getTask (@ NonNull String tag );
48
-
49
-
48
+
50
49
@ MainThread
51
50
public abstract Task <?, ?> attach (@ NonNull String tag , @ NonNull Task .Callback callback );
52
51
@@ -71,18 +70,54 @@ public interface TaskAttachListener {
71
70
@ MainThread
72
71
public abstract Task <?, ?> cancel (@ NonNull String tag );
73
72
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
+ */
74
82
@ MainThread
75
83
public abstract <Progress , Result > void execute (@ NonNull Task <Progress , Result > task , @ NonNull Task .Callback callback );
76
84
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
+ */
77
94
@ MainThread
78
95
public abstract <Progress , Result > void execute (@ NonNull Task <Progress , Result > task , @ NonNull Task .Callback callback , @ NonNull Executor executor );
79
96
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
+ */
80
103
@ MainThread
81
104
public abstract boolean isResultDelivered (@ NonNull String tag );
82
105
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
+ */
83
113
@ MainThread
84
114
public abstract boolean isRunning (@ NonNull String tag );
85
115
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
+ */
86
121
@ MainThread
87
122
public abstract void assertAllTasksDetached () throws IllegalStateException ;
88
123
0 commit comments