Package com.yahoo.processing.execution
Class AsyncExecution
java.lang.Object
com.yahoo.processing.execution.AsyncExecution
Provides asynchronous execution of processing chains. Usage:
Execution execution = new Execution(chain); AsyncExecution asyncExecution = new AsyncExecution(execution); Future<Response> future = asyncExecution.process(request) try { result = future.get(timeout, TimeUnit.milliseconds); } catch(TimeoutException e) { // Handle timeout }
The request is not thread safe. A clone() must be made for each parallel processing.
- Author:
- bratseth
- See Also:
-
Constructor Summary
ConstructorDescriptionAsyncExecution
(Chain<? extends Processor> chain, Execution parent) Create an async execution of a chainAsyncExecution
(Execution execution) Creates an async execution from an existing execution.AsyncExecution
(Processor processor, Execution parent) Create an async execution of a single processor -
Method Summary
Modifier and TypeMethodDescriptionPerforms an async processing.waitForAll
(Collection<FutureResponse> tasks, long timeout)
-
Constructor Details
-
AsyncExecution
Create an async execution of a single processor -
AsyncExecution
Create an async execution of a chain -
AsyncExecution
Creates an async execution from an existing execution. This async execution will execute the chain from the given execution, starting from the next processor in that chain. This is handy to execute multiple executions to the rest of the chain in parallel.The state of the given execution is read on construction of this and not used later - the argument execution can be reused for other purposes.
- Parameters:
execution
- the execution from which the state of this is created
-
-
Method Details
-
process
Performs an async processing. Note that the given request cannot be simultaneously used in multiple such processings - a clone must be created for each. -
waitForAll
-