diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-09-21 13:19:18 -0700 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-09-21 13:19:18 -0700 |
commit | b8cb4d849adbf4118903a8d11451d95829df1fb0 (patch) | |
tree | 2e9440f5c3200002eb16f26cc178546b32d4e6e9 /processing | |
parent | 569c2f0d781b33c17aadf6929fef2388643e1d64 (diff) |
Nonfunctional changes only
Diffstat (limited to 'processing')
-rw-r--r-- | processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java | 29 |
1 files changed, 14 insertions, 15 deletions
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 eac96e9b408..2c40165f8e5 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(final Processor processor, Execution parent) { + public AsyncExecution(Processor processor, Execution parent) { this(new Execution(processor, parent)); } /** * Create an async execution of a chain */ - public AsyncExecution(final Chain<? extends Processor> chain, Execution parent) { + public AsyncExecution(Chain<? extends Processor> 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(final Execution execution) { + public AsyncExecution(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(final Request request) { + public FutureResponse process(Request request) { return getFutureResponse(new Callable<Response>() { @Override public Response call() { @@ -99,13 +99,13 @@ public class AsyncExecution { } private static <T> Future<T> getFuture(final Callable<T> callable) { - final FutureTask<T> future = new FutureTask<>(callable); + FutureTask<T> future = new FutureTask<>(callable); executorMain.execute(future); return future; } - private FutureResponse getFutureResponse(final Callable<Response> callable, final Request request) { - final FutureResponse future = new FutureResponse(callable, execution, request); + private FutureResponse getFutureResponse(Callable<Response> callable, Request request) { + 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<Response> waitForAll(final Collection<FutureResponse> tasks, final long timeout) { + public static List<Response> waitForAll(Collection<FutureResponse> tasks, long timeout) { // Copy the list in case it is modified while we are waiting - final List<FutureResponse> workingTasks = new ArrayList<>(tasks); + List<FutureResponse> workingTasks = new ArrayList<>(tasks); @SuppressWarnings({"rawtypes", "unchecked"}) - final Future task = getFuture(new Callable() { + Future task = getFuture(new Callable() { @Override public List<Future> call() { - for (final FutureResponse task : workingTasks) { + for (FutureResponse task : workingTasks) { task.get(); } return null; @@ -135,12 +135,12 @@ public class AsyncExecution { try { task.get(timeout, TimeUnit.MILLISECONDS); - } catch (final TimeoutException | InterruptedException | ExecutionException e) { + } catch (TimeoutException | InterruptedException | ExecutionException e) { // Handle timeouts below } - final List<Response> responses = new ArrayList<>(tasks.size()); - for (final FutureResponse future : workingTasks) + List<Response> responses = new ArrayList<>(tasks.size()); + for (FutureResponse future : workingTasks) responses.add(getTaskResponse(future)); return responses; } @@ -153,5 +153,4 @@ public class AsyncExecution { } } - } |