com.amazonaws.services.simpleworkflow.flow.core
Class Task
java.lang.Object
com.amazonaws.services.simpleworkflow.flow.core.Task
public abstract class Task
- extends Object
Asynchronous task that is executed when all Promises 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;
}
- See Also:
AsyncScope,
TryCatchFinally,
Promise
|
Constructor Summary |
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)
|
Task
public Task(Promise<?>... waitFor)
Task
public Task(boolean daemon,
Promise<?>... waitFor)
Task
public Task(com.amazonaws.services.simpleworkflow.flow.core.AsyncContextAware parent,
boolean daemon,
Promise<?>... waitFor)
Task
public Task(com.amazonaws.services.simpleworkflow.flow.core.AsyncContextAware parent,
Promise<?>... waitFor)
getName
public String getName()
setName
public void setName(String name)
getStackTrace
public StackTraceElement[] getStackTrace()
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.