V
- The result type returned by this Promise's get method. Use
Void
to represent Promise that indicates completion of
operation that doesn't return a value.public abstract class Promise<V> extends Object
Task.doExecute()
method assuming that promise was
passed to the Task as a constructor parameter.
Promise is not linked to error handling like Future is. In case of exceptions
they are propagated to the TryCatchFinally.doCatch(Throwable)
method
of the TryCatchFinally
that owns the asynchronous task that failed.
See TryCatchFinally
for more info on the error handling.
For promises that don't need a value and just used to ensure correct ordering
of asynchronous operations the common pattern to use Void
as a
generic type.
Constructor and Description |
---|
Promise() |
Modifier and Type | Method and Description |
---|---|
static <T> Promise<T> |
asPromise(T value)
Convenience method for creating a Promise object which is in ready state
and returns the passed in value when get() is called.
|
abstract V |
get() |
String |
getDescription() |
abstract boolean |
isReady() |
static Promise<Void> |
Void()
This is a factory method to create a Promise
|
public abstract V get()
IllegalStateException
- if result of your asynchronous computation is not available
yetpublic abstract boolean isReady()
true
if the result of your asynchronous computation
is availablepublic String getDescription()
AsyncScope.getAsynchronousThreadDumpAsString()
public static <T> Promise<T> asPromise(T value)
The same as new
Settable
T
- Type of valuevalue
- Object to return when get() is calledCopyright © 2013 Amazon Web Services, Inc. All Rights Reserved.