Asynchronous task that is executed when all {@link Promise}s passed to its constructor are ready (
null
parameter is considered ready).
Should be created in the context of {@link AsyncScope#doAsync()} method, from{@link Task#doExecute()} or from {@link TryCatchFinally} do... methods.Exceptions thrown from {@link #doExecute()} are delivered asynchronously tothe wrapping {@link TryCatchFinally#doCatch(Throwable)} method or rethrownfrom {@link AsyncScope#eventLoop()} if no wrapping {@link TryCatchFinally} isfound.
Example of using {@link Task} to implement asynchronous function that sumsparameters when both of them are ready:
public Promise<Integer> sum(Promise<Integer> a, Promise<Integer> b) { Settable<Integer> result = new Settable<Integer>(); new Task(a, b) { public void doExecute() { result.set(a.get() + b.get()); } }; return result; }
@see AsyncScope
@see TryCatchFinally
@see Promise