Package org.dataloader.impl
Class PromisedValuesImpl<T>
java.lang.Object
org.dataloader.impl.PromisedValuesImpl<T>
- All Implemented Interfaces:
PromisedValues<T>
-
Method Summary
Modifier and TypeMethodDescriptioncause()The exception cause or null if it didn't failcause(int index) The exception cause at the specified index or null if it didn't failstatic <T> PromisedValues<T>combineAllOf(List<? extends CompletionStage<T>> cfs) static <T> PromisedValues<T>combinePromisedValues(List<PromisedValues<T>> promisedValues) booleanfailed()get(int index) The value at index or null if it failedbooleanisDone()The true if the all the futures have completed (and hence thisPromisedValueshas completed)join()Waits for the underlying futures to complete.intsize()booleanbooleansucceeded(int index) The true if theCompletionStageat the specified index succeededthenAccept(Consumer<PromisedValues<T>> handler) When the all the futures complete, this call back will be invoked with thisPromisedValuesas a parametertoList()Returns the underlying values as a list
-
Method Details
-
combineAllOf
-
combinePromisedValues
-
thenAccept
Description copied from interface:PromisedValuesWhen the all the futures complete, this call back will be invoked with thisPromisedValuesas a parameter- Specified by:
thenAcceptin interfacePromisedValues<T>- Parameters:
handler- the call back which will be given this object- Returns:
- a new
PromisedValueswhich you can compose more computations with
-
succeeded
public boolean succeeded()- Specified by:
succeededin interfacePromisedValues<T>- Returns:
- true if all the futures completed successfully
-
failed
public boolean failed()- Specified by:
failedin interfacePromisedValues<T>- Returns:
- true if any of the futures completed unsuccessfully
-
isDone
public boolean isDone()Description copied from interface:PromisedValuesThe true if the all the futures have completed (and hence thisPromisedValueshas completed)- Specified by:
isDonein interfacePromisedValues<T>- Returns:
- true if all the futures have completed
-
cause
Description copied from interface:PromisedValuesThe exception cause or null if it didn't fail- Specified by:
causein interfacePromisedValues<T>- Returns:
- an exception or null if the future did not fail
-
succeeded
public boolean succeeded(int index) Description copied from interface:PromisedValuesThe true if theCompletionStageat the specified index succeeded- Specified by:
succeededin interfacePromisedValues<T>- Parameters:
index- the index of theCompletionStage- Returns:
- true if the future at the specified index succeeded
-
cause
Description copied from interface:PromisedValuesThe exception cause at the specified index or null if it didn't fail- Specified by:
causein interfacePromisedValues<T>- Parameters:
index- the index of theCompletionStage- Returns:
- an exception or null if the future did not fail
-
get
Description copied from interface:PromisedValuesThe value at index or null if it failed- Specified by:
getin interfacePromisedValues<T>- Parameters:
index- the index of the future- Returns:
- the value of the future
-
toList
Description copied from interface:PromisedValuesReturns the underlying values as a list- Specified by:
toListin interfacePromisedValues<T>- Returns:
- the list of underlying values
-
size
public int size()- Specified by:
sizein interfacePromisedValues<T>- Returns:
- the number of
CompletionStages under the covers
-
join
Description copied from interface:PromisedValuesWaits for the underlying futures to complete. To better conform with the use of common functional forms, if a computation involved in the completion of this CompletableFuture threw an exception, this method throws an (unchecked)CompletionExceptionwith the underlying exception as its cause.- Specified by:
joinin interfacePromisedValues<T>- Returns:
- the list of completed values similar to
PromisedValues.toList()
-
toCompletableFuture
- Specified by:
toCompletableFuturein interfacePromisedValues<T>- Returns:
- this as a
CompletableFuturethat returns the list of underlying values
-