@@ -68,9 +68,6 @@ public class Task {
6868 /** Maximum of current stage */
6969 private final AtomicLong max = new AtomicLong (1 );
7070
71- /** Number of subtasks completed */
72- private final AtomicLong subTasksCompleted = new AtomicLong (0 );
73-
7471 /**
7572 * True iff a call to {@link Task#define(long, long)} has been made
7673 */
@@ -116,7 +113,6 @@ public void complete() {
116113 if (hasElements ) {
117114 this .current .set (this .max .get ());
118115 }
119- if (parent != null ) parent .recordSubtaskCompletion (this );
120116 }
121117
122118 /**
@@ -172,6 +168,7 @@ public void define(final long elements, final long subTasks) {
172168 if (elements == 0 ) {
173169 this .hasElements = false ;
174170 if (this .tasks == 0 ) {
171+ this .tasks = 1 ;
175172 this .current .set (1 );
176173 this .max .set (1 );
177174 return ;
@@ -210,18 +207,6 @@ public double progress() {
210207 return totalCompletion / tasks ;
211208 }
212209
213- /**
214- * Iff {@code task} was a task generated by this {@link Task}, then we update
215- * progress based on its completion.
216- *
217- * @param task a {@link Task} generated by this one
218- */
219- private void recordSubtaskCompletion (final Task task ) {
220- if (!subTasks .contains (task )) throw new IllegalArgumentException (
221- "Task " + task + " is not a subtask of Task " + this );
222- if (tasksDefined ) subTasksCompleted .getAndIncrement ();
223- }
224-
225210 /**
226211 * Used by the progressible {@link Object} to set the status of its
227212 * computation. This method should <b>not</b> used by any code not part of the
0 commit comments