Skip to content

Commit 7802139

Browse files
SeqTask: don't hold on to taks list longer than necessary
1 parent f5e047f commit 7802139

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/com/linkedin/parseq/SeqTask.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import com.linkedin.parseq.promise.Promise;
2121
import com.linkedin.parseq.promise.Promises;
2222
import com.linkedin.parseq.promise.SettablePromise;
23-
import com.linkedin.parseq.trace.ShallowTrace;
24-
import com.linkedin.parseq.trace.ShallowTraceBuilder;
2523

2624
import java.util.ArrayList;
2725
import java.util.Collections;
@@ -30,15 +28,15 @@
3028
/**
3129
* A {@link Task} that will run the constructor-supplied tasks one after the other.
3230
* <p/>
33-
* Use {@link Tasks#seq(Iterable)} or {@link Tasks#seq(Task[])} to create
31+
* Use {@link Tasks#seq(Iterable)} or {@link Tasks#seq(java.lang.Iterable)} to create
3432
* instances of this class.
3533
*
3634
* @author Chris Pettitt ([email protected])
3735
* @author Chi Chan ([email protected])
3836
*/
3937
/* package private */ class SeqTask<T> extends SystemHiddenTask<T>
4038
{
41-
private final List<Task<?>> _tasks;
39+
private volatile List<Task<?>> _tasks;
4240

4341
public SeqTask(final String name, final Iterable<? extends Task<?>> tasks)
4442
{
@@ -54,7 +52,6 @@ public SeqTask(final String name, final Iterable<? extends Task<?>> tasks)
5452
throw new IllegalArgumentException("No tasks to sequence!");
5553
}
5654

57-
5855
_tasks = Collections.unmodifiableList(taskList);
5956
}
6057

@@ -77,6 +74,9 @@ protected Promise<? extends T> run(final Context context) throws Exception
7774
final Task<T> typedPrevTask = (Task<T>)prevTask;
7875
Promises.propagateResult(typedPrevTask, result);
7976
context.run(_tasks.get(0));
77+
78+
_tasks = null;
79+
8080
return result;
8181
}
8282
}

0 commit comments

Comments
 (0)