Class MapOperation<I,O>
java.lang.Object
software.amazon.lambda.durable.operation.BaseDurableOperation
software.amazon.lambda.durable.operation.SerializableDurableOperation<T>
software.amazon.lambda.durable.operation.ConcurrencyOperation<MapResult<O>>
software.amazon.lambda.durable.operation.MapOperation<I,O>
- Type Parameters:
I- the input item typeO- the output result type per item
- All Implemented Interfaces:
DurableFuture<MapResult<O>>
Executes a map operation: applies a function to each item in a collection concurrently, with each item running in its
own child context.
Extends ConcurrencyOperation following the same pattern as ParallelOperation. All branches are
created upfront in start()/replay(), and results are aggregated into a MapResult in
get().
-
Field Summary
Fields inherited from class software.amazon.lambda.durable.operation.ConcurrencyOperation
isJoinedFields inherited from class software.amazon.lambda.durable.operation.BaseDurableOperation
completionFuture, executionManager, parentOperation -
Constructor Summary
ConstructorsConstructorDescriptionMapOperation(OperationIdentifier operationIdentifier, List<I> items, DurableContext.MapFunction<I, O> function, TypeToken<O> itemResultType, MapConfig config, DurableContextImpl durableContext) -
Method Summary
Modifier and TypeMethodDescriptionget()Blocks until the operation completes and returns the result.protected voidhandleCompletion(ConcurrencyCompletionStatus concurrencyCompletionStatus) Called when the concurrency operation completes.protected voidreplay(software.amazon.awssdk.services.lambda.model.Operation existing) Replays the operation from an existing checkpoint.protected voidstart()Starts the operation on first execution (no existing checkpoint).Methods inherited from class software.amazon.lambda.durable.operation.ConcurrencyOperation
createItem, enqueueItem, executeItems, getBranches, joinMethods inherited from class software.amazon.lambda.durable.operation.SerializableDurableOperation
deserializeException, deserializeResult, serializeException, serializeResultMethods inherited from class software.amazon.lambda.durable.operation.BaseDurableOperation
execute, getChildOperations, getCompletionFuture, getContext, getCurrentThreadContext, getName, getOperation, getOperationId, getSubType, getType, isOperationCompleted, markAlreadyCompleted, onCheckpointComplete, pollForOperationUpdates, pollForOperationUpdates, registerActiveThread, runUserHandler, sendOperationUpdate, sendOperationUpdateAsync, terminateExecution, terminateExecutionWithIllegalDurableOperationException, validateReplay, waitForOperationCompletion
-
Constructor Details
-
MapOperation
public MapOperation(OperationIdentifier operationIdentifier, List<I> items, DurableContext.MapFunction<I, O> function, TypeToken<O> itemResultType, MapConfig config, DurableContextImpl durableContext)
-
-
Method Details
-
start
protected void start()Description copied from class:BaseDurableOperationStarts the operation on first execution (no existing checkpoint).- Specified by:
startin classBaseDurableOperation
-
replay
protected void replay(software.amazon.awssdk.services.lambda.model.Operation existing) Description copied from class:BaseDurableOperationReplays the operation from an existing checkpoint.- Specified by:
replayin classBaseDurableOperation- Parameters:
existing- the checkpointed operation state
-
handleCompletion
Description copied from class:ConcurrencyOperationCalled when the concurrency operation completes. Subclasses define checkpointing behavior.- Specified by:
handleCompletionin classConcurrencyOperation<MapResult<O>>
-
get
Description copied from interface:DurableFutureBlocks 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
- Specified by:
getin interfaceDurableFuture<I>- Specified by:
getin classSerializableDurableOperation<MapResult<O>>- Returns:
- the operation result
-