mirror of https://github.com/apache/druid.git
remove deadlock problem in pending tasks
This commit is contained in:
parent
c9cf091998
commit
375e342d5f
|
@ -241,35 +241,28 @@ public class RemoteTaskRunner implements TaskRunner
|
||||||
*/
|
*/
|
||||||
private void runPendingTasks()
|
private void runPendingTasks()
|
||||||
{
|
{
|
||||||
Future future = runPendingTasksExec.submit(
|
runPendingTasksExec.submit(
|
||||||
new Callable<Void>()
|
new Callable<Void>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception
|
public Void call() throws Exception
|
||||||
{
|
{
|
||||||
// make a copy of the pending tasks because assignTask may delete tasks from pending and move them
|
try {
|
||||||
// into running status
|
// make a copy of the pending tasks because assignTask may delete tasks from pending and move them
|
||||||
List<TaskRunnerWorkItem> copy = Lists.newArrayList(pendingTasks.values());
|
// into running status
|
||||||
for (TaskRunnerWorkItem taskWrapper : copy) {
|
List<TaskRunnerWorkItem> copy = Lists.newArrayList(pendingTasks.values());
|
||||||
assignTask(taskWrapper);
|
for (TaskRunnerWorkItem taskWrapper : copy) {
|
||||||
|
assignTask(taskWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
log.makeAlert(e, "Exception in running pending tasks").emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
|
||||||
future.get();
|
|
||||||
}
|
|
||||||
catch (InterruptedException e) {
|
|
||||||
log.error(e, "InterruptedException in runPendingTasks()");
|
|
||||||
throw Throwables.propagate(e);
|
|
||||||
}
|
|
||||||
catch (ExecutionException e) {
|
|
||||||
log.error(e, "ExecutionException in runPendingTasks()");
|
|
||||||
throw Throwables.propagate(e.getCause());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue