fix the pre middle manager peon no stop

This commit is contained in:
jianran.tfh 2016-08-11 10:25:04 +08:00
parent 5920bdebc8
commit 6cef4980bf
1 changed files with 20 additions and 4 deletions

View File

@ -46,10 +46,7 @@ import io.druid.indexing.overlord.config.TaskQueueConfig;
import io.druid.metadata.EntryExistsException; import io.druid.metadata.EntryExistsException;
import io.druid.query.DruidMetrics; import io.druid.query.DruidMetrics;
import java.util.Collection; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -195,6 +192,25 @@ public class TaskQueue
giant.lock(); giant.lock();
try { try {
if (taskRunner.getRunningTasks() != null) {
int i = 0;
for (TaskRunnerWorkItem item : taskRunner.getRunningTasks()) {
if (++ i >= taskRunner.getRunningTasks().size()) {
break;
}
Iterator<Task> iter = tasks.iterator();
while (iter.hasNext()) {
Task task = iter.next();
if (task.getId().equals(item.getTaskId())) {
log.info("start notify success task:%s", task.getId());
notifyStatus(task, TaskStatus.success(task.getId()));
log.info("end notify success task:%s", task.getId());
break;
}
}
}
}
tasks.clear(); tasks.clear();
taskFutures.clear(); taskFutures.clear();
active = false; active = false;