formatting

This commit is contained in:
nishantmonu51 2014-11-17 17:44:26 +05:30
parent fd8eb7742b
commit ad1dd161e7
1 changed files with 28 additions and 29 deletions

View File

@ -22,7 +22,6 @@ package io.druid.indexing.overlord;
import com.google.api.client.repackaged.com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
@ -91,19 +90,19 @@ public class ThreadPoolTaskRunner implements TaskRunner, QuerySegmentWalker
runningItems.add(taskRunnerWorkItem);
Futures.addCallback(
statusFuture, new FutureCallback<TaskStatus>()
{
@Override
public void onSuccess(TaskStatus result)
{
runningItems.remove(taskRunnerWorkItem);
}
{
@Override
public void onSuccess(TaskStatus result)
{
runningItems.remove(taskRunnerWorkItem);
}
@Override
public void onFailure(Throwable t)
{
runningItems.remove(taskRunnerWorkItem);
}
}
@Override
public void onFailure(Throwable t)
{
runningItems.remove(taskRunnerWorkItem);
}
}
);
return statusFuture;
@ -159,32 +158,32 @@ public class ThreadPoolTaskRunner implements TaskRunner, QuerySegmentWalker
{
final List<String> dataSources = query.getDataSource().getNames();
List<QueryRunner> runners = Lists.newArrayList();
for(String queryDataSource : dataSources) {
for (String queryDataSource : dataSources) {
QueryRunner<T> queryRunner = null;
for (final ThreadPoolTaskRunnerWorkItem taskRunnerWorkItem : ImmutableList.copyOf(runningItems)) {
final Task task = taskRunnerWorkItem.getTask();
if (task.getDataSource().equals(queryDataSource)) {
final QueryRunner<T> taskQueryRunner = task.getQueryRunner(query);
for (final ThreadPoolTaskRunnerWorkItem taskRunnerWorkItem : ImmutableList.copyOf(runningItems)) {
final Task task = taskRunnerWorkItem.getTask();
if (task.getDataSource().equals(queryDataSource)) {
final QueryRunner<T> taskQueryRunner = task.getQueryRunner(query);
if (taskQueryRunner != null) {
if (queryRunner == null) {
queryRunner = taskQueryRunner;
} else {
log.makeAlert("Found too many query runners for datasource")
.addData("dataSource", queryDataSource)
.emit();
if (taskQueryRunner != null) {
if (queryRunner == null) {
queryRunner = taskQueryRunner;
} else {
log.makeAlert("Found too many query runners for datasource")
.addData("dataSource", queryDataSource)
.emit();
}
}
}
}
}
if(queryRunner!= null) {
if (queryRunner != null) {
runners.add(queryRunner);
}
}
if(runners.size() == 0){
if (runners.size() == 0) {
return new NoopQueryRunner();
} else if (runners.size() == 1){
} else if (runners.size() == 1) {
return runners.get(0);
} else {
return new UnionQueryRunner<>(runners, conglomerate.findFactory(query).getToolchest());