Interface StopWithSavepointTerminationHandler
- All Known Implementing Classes:
StopWithSavepointTerminationHandlerImpl
public interface StopWithSavepointTerminationHandler
StopWithSavepointTerminationHandler handles the steps necessary for the
stop-with-savepoint operation to finish. The order of the operations matter:
- Creating a savepoint needs to be completed
- Waiting for the executions of the underlying job to finish
-
Method Summary
Modifier and TypeMethodDescriptionReturns the aCompletableFuturereferring to the result of the stop-with-savepoint operation.voidhandleExecutionsTermination(Collection<ExecutionState> terminatedExecutionStates) Handles the termination of the job based on the passed terminatedExecutionStates. stop-with-savepoint expects theterminatedExecutionStatesto only containExecutionState.FINISHEDto succeed.voidhandleSavepointCreation(CompletedCheckpoint completedSavepoint, Throwable throwable) Handles the result of aCompletableFutureholding aCompletedCheckpoint.
-
Method Details
-
getSavepointPath
CompletableFuture<String> getSavepointPath()Returns the aCompletableFuturereferring to the result of the stop-with-savepoint operation.- Returns:
- the
CompletableFuturecontaining the path to the created savepoint in case of success.
-
handleSavepointCreation
void handleSavepointCreation(@Nullable CompletedCheckpoint completedSavepoint, @Nullable Throwable throwable) Handles the result of aCompletableFutureholding aCompletedCheckpoint. Only one of the two parameters are allowed to be set.- Parameters:
completedSavepoint- theCompletedCheckpointreferring to the created savepointthrowable- an error that was caught during savepoint creation- Throws:
IllegalArgumentException- ifthrowableandcompletedSavepointare setNullPointerException- if none of the parameters is set
-
handleExecutionsTermination
Handles the termination of the job based on the passed terminatedExecutionStates. stop-with-savepoint expects theterminatedExecutionStatesto only containExecutionState.FINISHEDto succeed.- Parameters:
terminatedExecutionStates- The terminatedExecutionStatesof the underlying job.- Throws:
NullPointerException- ifnullis passed.
-