Package software.amazon.lambda.durable
Interface DurableFuture<T>
- Type Parameters:
T- the result type
- All Known Subinterfaces:
DurableCallbackFuture<T>,ParallelDurableFuture
- All Known Implementing Classes:
CallbackOperation,ChildContextOperation,CompletedDurableFuture,ConcurrencyOperation,InvokeOperation,MapOperation,ParallelOperation,SerializableDurableOperation,StepOperation,WaitForConditionOperation,WaitOperation
public interface DurableFuture<T>
A future representing the result of an asynchronous durable operation.
Calling get() blocks the current thread until the operation completes, which may involve suspension and
replay across Lambda invocations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T>allOf(List<DurableFuture<T>> futures) Waits for all provided futures to complete and returns their results in order.static <T> List<T>allOf(DurableFuture<T>... futures) Waits for all provided futures to complete and returns their results in order.static ObjectanyOf(DurableFuture<?>... futures) Waits for any of the provided futures to complete and returns its result.get()Blocks until the operation completes and returns the result.
-
Method Details
-
get
T get()Blocks until the operation completes and returns the result.This delegates to operation.get() which handles: - Thread deregistration (allows suspension) - Thread reactivation (resumes execution) - Result retrieval
- Returns:
- the operation result
-
allOf
Waits for all provided futures to complete and returns their results in order.The futures are resolved sequentially, but since the underlying operations run concurrently, this effectively waits for all operations to complete. During replay, completed operations return immediately.
- Type Parameters:
T- the result type of the futures- Parameters:
futures- the futures to wait for- Returns:
- a list of results in the same order as the input futures
-
allOf
Waits for all provided futures to complete and returns their results in order.The futures are resolved sequentially, but since the underlying operations run concurrently, this effectively waits for all operations to complete. During replay, completed operations return immediately.
- Type Parameters:
T- the result type of the futures- Parameters:
futures- the list of futures to wait for- Returns:
- a list of results in the same order as the input futures
-
anyOf
Waits for any of the provided futures to complete and returns its result.- Parameters:
futures- the futures to wait for- Returns:
- the result of the first future to complete
-