public abstract class Task extends Object
Promise
s passed to its
constructor are ready (null
parameter is considered ready).
Should be created in the context of AsyncScope.doAsync()
method, from
doExecute()
or from TryCatchFinally
do... methods.
Exceptions thrown from doExecute()
are delivered asynchronously to
the wrapping TryCatchFinally.doCatch(Throwable)
method or rethrown
from AsyncScope.eventLoop()
if no wrapping TryCatchFinally
is
found.
Example of using Task
to implement asynchronous function that sums
parameters 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; }
AsyncScope
,
TryCatchFinally
,
Promise
Constructor and Description |
---|
Task(com.amazonaws.services.simpleworkflow.flow.core.AsyncContextAware parent,
boolean daemon,
Promise<?>... waitFor) |
Task(com.amazonaws.services.simpleworkflow.flow.core.AsyncContextAware parent,
Promise<?>... waitFor) |
Task(boolean daemon,
Promise<?>... waitFor) |
Task(Promise<?>... waitFor) |
Modifier and Type | Method and Description |
---|---|
String |
getName() |
StackTraceElement[] |
getStackTrace() |
void |
setName(String name) |
String |
toString() |
public Task(Promise<?>... waitFor)
public Task(boolean daemon, Promise<?>... waitFor)
public Task(com.amazonaws.services.simpleworkflow.flow.core.AsyncContextAware parent, boolean daemon, Promise<?>... waitFor)
public Task(com.amazonaws.services.simpleworkflow.flow.core.AsyncContextAware parent, Promise<?>... waitFor)
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.