|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.asyncobjects.util.Wait
public class Wait
This utility class allows waiting on some conditions related to promises.
Constructor Summary | |
---|---|
Wait()
|
Method Summary | |
---|---|
static Promise<Object[]> |
all(Promise<?>... promises)
This method allows waiting until operations represented by promises will finish. |
static Promise<Object> |
any(boolean ignoreFailures,
Collection<?> values)
A utilty variant of any(boolean, Iterator) method that gets a
Collection as argument. |
static Promise<Object> |
any(boolean ignoreFailures,
Iterator<Object> values)
Calculate first ready value of failure from the iterator. |
static Promise<Object> |
any(boolean ignoreFailures,
Object[] values)
A utilty variant of any(boolean, Iterator) method that gets an
array as argument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Wait()
Method Detail |
---|
public static Promise<Object[]> all(Promise<?>... promises)
promises
- an array of promises to watch. Null is considered to be
promise that is already resolved to null.
public static Promise<Object> any(boolean ignoreFailures, Iterator<Object> values)
Promise
AsyncObject
AsyncAction
AsyncAction.executeNow()
method. The result is interpreted as for promise. This is used to express
lazy values for this method.Compensated
Compensated.run()
method. If value
or failure is not used, they are compensated with
Compensated.compensateValue(Object)
and
Compensated.compensateFailure(Throwable)
method correspondingly.
As soon as it known that value will not be used, the method
Compensated.cancel()
is called.
ignoreFailures
- if this flag true, failures are not treated as normal return
values. The method instead tries to receive success result
first. only if all branches failed, first received failure
made result of any construct.values
- an iterator over values. If iterator is empty, the method
finishes with exception. Iterator is assumed to never throw an
exception if Iterator.hasNext()
method was successful.
However failure can be expressed as smashed promise.
public static Promise<Object> any(boolean ignoreFailures, Collection<?> values)
any(boolean, Iterator)
method that gets a
Collection
as argument.
ignoreFailures
- if true, failures are ignoredvalues
- a collection of asynchronous results
public static Promise<Object> any(boolean ignoreFailures, Object[] values)
any(boolean, Iterator)
method that gets an
array as argument.
ignoreFailures
- if true, failures are ignoredvalues
- a collection of asynchronous results
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |