Class WaitForConditionOperation<T>
java.lang.Object
software.amazon.lambda.durable.operation.BaseDurableOperation
software.amazon.lambda.durable.operation.SerializableDurableOperation<T>
software.amazon.lambda.durable.operation.WaitForConditionOperation<T>
- Type Parameters:
T- the type of state being polled
- All Implemented Interfaces:
DurableFuture<T>
Durable operation that periodically checks a user-supplied condition function, using a configurable wait strategy to
determine polling intervals and termination.
Uses OperationType#STEP with OperationSubType#WAIT_FOR_CONDITION subtype. Each polling iteration
is checkpointed as a RETRY on the same STEP operation.
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.lambda.durable.operation.SerializableDurableOperation
SerializableDurableOperation.SerializedResult<T> -
Field Summary
Fields inherited from class software.amazon.lambda.durable.operation.BaseDurableOperation
completionFuture, executionManager, isVirtual, parentOperation, replayCompletedOperation -
Constructor Summary
ConstructorsConstructorDescriptionWaitForConditionOperation(OperationIdentifier operationIdentifier, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, TypeToken<T> resultTypeToken, WaitForConditionConfig<T> config, DurableContextImpl durableContext) -
Method Summary
Modifier and TypeMethodDescriptionget()Blocks until the operation completes and returns the result.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.SerializableDurableOperation
deserializeException, deserializeResult, serDesContext, serializeAndDeserializeResult, serializeExceptionMethods inherited from class software.amazon.lambda.durable.operation.BaseDurableOperation
deregisterActiveThread, execute, extractErrorFromOperation, fireOnOperationEnd, getChildOperations, getCompletionFuture, getContext, getCurrentThreadContext, getErrorObject, getName, getOperation, getOperationId, getRunningUserHandler, getSubType, getType, interruptRunningUserHandler, isOperationCompleted, isRunningUserHandlerOwner, markAlreadyCompleted, onCheckpointComplete, pollForOperationUpdates, pollForOperationUpdates, processCheckpointUpdate, registerActiveThread, runUserFunction, runUserHandler, sendOperationUpdate, sendOperationUpdateAsync, terminateExecution, terminateExecutionWithIllegalDurableOperationException, validateReplay, waitForFirstOperationCompletion, waitForOperationCompletion
-
Constructor Details
-
WaitForConditionOperation
public WaitForConditionOperation(OperationIdentifier operationIdentifier, BiFunction<T, StepContext, WaitForConditionResult<T>> checkFunc, TypeToken<T> resultTypeToken, WaitForConditionConfig<T> 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
-
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<T>- Specified by:
getin classSerializableDurableOperation<T>- Returns:
- the operation result
-