T - The value type associated with the created Promise.public class Deferred<T> extends Object
| Constructor and Description |
|---|
Deferred()
Create a new Deferred with an associated Promise.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fail(Throwable failure)
Fail the Promise associated with this Deferred.
|
Promise<T> |
getPromise()
Returns the Promise associated with this Deferred.
|
void |
resolve(T value)
Successfully resolve the Promise associated with this Deferred.
|
Promise<Void> |
resolveWith(Promise<? extends T> with)
Resolve the Promise associated with this Deferred with the specified Promise.
|
public Promise<T> getPromise()
public void resolve(T value)
value - The value of the resolved Promise.IllegalStateException - If the associated Promise was already resolved.public void fail(Throwable failure)
failure - The failure of the resolved Promise. Must not be null.IllegalStateException - If the associated Promise was already resolved.public Promise<Void> resolveWith(Promise<? extends T> with)
with - A Promise whose value or failure will be used to resolve the associated Promise. Must not be null.Copyright © 2009-2015 The Apache Software Foundation. All Rights Reserved.