Class RunningSteps
- All Implemented Interfaces:
DescribableComponent
CompletableFutures for workflow steps, keyed by step name.- Since:
- 5.4.0
- Author:
- Stefan Dragisic
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCancel all running steps, waiting for them to complete and passing the cancelled step names to the given consumer.voidcancelAndRemove(String stepName, boolean mayInterruptIfRunning) Cancel and remove a running step.booleancancelWithCause(String stepName, @Nullable Throwable cause) Cancel a running step providing a cause to be used for the cancellation as a failed future cause.voiddescribeTo(ComponentDescriptor descriptor) Describe the properties ofthis DescribableComponentwith the givendescriptor.voidregister(String stepName, CompletableFuture<?> future) Register a new running step.voidRemove a running step.Returns a snapshot of the names of the currently-running steps.
-
Constructor Details
-
RunningSteps
public RunningSteps()
-
-
Method Details
-
register
Register a new running step.- Parameters:
stepName- step name.future- future to register.
-
remove
Remove a running step.- Parameters:
stepName- step name.
-
stepNames
Returns a snapshot of the names of the currently-running steps.- Returns:
- a snapshot set of the running step names.
-
cancelAndRemove
Cancel and remove a running step.- Parameters:
stepName- step name.mayInterruptIfRunning- whether to interrupt the step if it is running.
-
cancelWithCause
Cancel a running step providing a cause to be used for the cancellation as a failed future cause.- Parameters:
stepName- step name.cause- a cause for the cancellation.- Returns:
- true, if the future was cancelled successfully.
-
cancelAll
Cancel all running steps, waiting for them to complete and passing the cancelled step names to the given consumer.- Parameters:
cause- the cause of the cancellation.awaitTermination- consumer of cancelled step names.
-
describeTo
Description copied from interface:DescribableComponentDescribe the properties ofthis DescribableComponentwith the givendescriptor.Components should call the appropriate
describePropertymethods on the descriptor to register their properties. The descriptor is responsible for determining how these properties are formatted and structured in the final output.Best Practices: As a general rule, all relevant fields of a
DescribableComponentimplementation should be described in this method. However, developers have discretion to include only the fields that make sense in the context. Not every field may be meaningful for description purposes, especially internal implementation details. Furthermore, components might want to expose different information based on their current state. The final decision on what properties to include lies with the person implementing thedescribeTomethod, who should focus on providing information that is useful for understanding the component's configuration and state.Example implementation:
public void describeTo(ComponentDescriptor descriptor) { descriptor.describeProperty("name", this.name); descriptor.describeProperty("enabled", this.enabled); descriptor.describeProperty("configuration", this.configuration); // A nested component descriptor.describeProperty("handlers", this.eventHandlers); // A collection }- Specified by:
describeToin interfaceDescribableComponent- Parameters:
descriptor- The component descriptor to describethis DescribableComponentn its properties in.
-