Simplify InternalClusterService#submitStateUpdateTask with lambdas

This commit is contained in:
Jason Tedor 2015-11-25 12:04:09 -05:00
parent 1fb6a1f669
commit c3f97e7642
1 changed files with 4 additions and 13 deletions

View File

@ -290,19 +290,10 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
}
if (config.timeout() != null) {
updateTasksExecutor.execute(updateTask, threadPool.scheduler(), config.timeout(), new Runnable() {
@Override
public void run() {
threadPool.generic().execute(new Runnable() {
@Override
public void run() {
if (updateTask.processed.getAndSet(true) == false) {
listener.onFailure(source, new ProcessClusterEventTimeoutException(config.timeout(), source));
}
}
});
}
});
updateTasksExecutor.execute(updateTask, threadPool.scheduler(), config.timeout(), () -> threadPool.generic().execute(() -> {
if (updateTask.processed.getAndSet(true) == false) {
listener.onFailure(source, new ProcessClusterEventTimeoutException(config.timeout(), source));
}}));
} else {
updateTasksExecutor.execute(updateTask);
}