From dfe56b565f6728a6c537867d28e388cd04718071 Mon Sep 17 00:00:00 2001 From: Arnstein Ressem Date: Tue, 25 Sep 2018 19:13:14 +0200 Subject: Revert "Bratseth/rank type information 2" --- .../yahoo/processing/execution/AsyncExecution.java | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'processing/src/main') diff --git a/processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java b/processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java index 2c40165f8e5..eac96e9b408 100644 --- a/processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java +++ b/processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java @@ -59,14 +59,14 @@ public class AsyncExecution { /** * Create an async execution of a single processor */ - public AsyncExecution(Processor processor, Execution parent) { + public AsyncExecution(final Processor processor, Execution parent) { this(new Execution(processor, parent)); } /** * Create an async execution of a chain */ - public AsyncExecution(Chain chain, Execution parent) { + public AsyncExecution(final Chain chain, Execution parent) { this(new Execution(chain, parent)); } @@ -81,7 +81,7 @@ public class AsyncExecution { * * @param execution the execution from which the state of this is created */ - public AsyncExecution(Execution execution) { + public AsyncExecution(final Execution execution) { this.execution = new Execution(execution); } @@ -89,7 +89,7 @@ public class AsyncExecution { * Performs an async processing. Note that the given request cannot be simultaneously * used in multiple such processings - a clone must be created for each. */ - public FutureResponse process(Request request) { + public FutureResponse process(final Request request) { return getFutureResponse(new Callable() { @Override public Response call() { @@ -99,13 +99,13 @@ public class AsyncExecution { } private static Future getFuture(final Callable callable) { - FutureTask future = new FutureTask<>(callable); + final FutureTask future = new FutureTask<>(callable); executorMain.execute(future); return future; } - private FutureResponse getFutureResponse(Callable callable, Request request) { - FutureResponse future = new FutureResponse(callable, execution, request); + private FutureResponse getFutureResponse(final Callable callable, final Request request) { + final FutureResponse future = new FutureResponse(callable, execution, request); executorMain.execute(future.delegate()); return future; } @@ -118,15 +118,15 @@ public class AsyncExecution { * @return the list of responses in the same order as returned from the task collection */ // Note that this may also be achieved using guava Futures. Not sure if this should be deprecated because of it. - public static List waitForAll(Collection tasks, long timeout) { + public static List waitForAll(final Collection tasks, final long timeout) { // Copy the list in case it is modified while we are waiting - List workingTasks = new ArrayList<>(tasks); + final List workingTasks = new ArrayList<>(tasks); @SuppressWarnings({"rawtypes", "unchecked"}) - Future task = getFuture(new Callable() { + final Future task = getFuture(new Callable() { @Override public List call() { - for (FutureResponse task : workingTasks) { + for (final FutureResponse task : workingTasks) { task.get(); } return null; @@ -135,12 +135,12 @@ public class AsyncExecution { try { task.get(timeout, TimeUnit.MILLISECONDS); - } catch (TimeoutException | InterruptedException | ExecutionException e) { + } catch (final TimeoutException | InterruptedException | ExecutionException e) { // Handle timeouts below } - List responses = new ArrayList<>(tasks.size()); - for (FutureResponse future : workingTasks) + final List responses = new ArrayList<>(tasks.size()); + for (final FutureResponse future : workingTasks) responses.add(getTaskResponse(future)); return responses; } @@ -153,4 +153,5 @@ public class AsyncExecution { } } + } -- cgit v1.2.3