LUCENE-4177: possible fix for thread-safety issue causing test to never stop

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1368618 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-08-02 17:45:23 +00:00
parent 7fd7610b7a
commit 3c112d15e7
1 changed files with 9 additions and 1 deletions

View File

@ -331,7 +331,9 @@ public class TaskSequence extends PerfTask {
// Forwards top request to children
if (runningParallelTasks != null) {
for(ParallelTask t : runningParallelTasks) {
t.task.stopNow();
if (t != null) {
t.task.stopNow();
}
}
}
}
@ -355,6 +357,12 @@ public class TaskSequence extends PerfTask {
// run threads
startThreads(t);
if (stopNow) {
for (ParallelTask task : t) {
task.task.stopNow();
}
}
// wait for all threads to complete
int count = 0;
for (int i = 0; i < t.length; i++) {