Package com.axelor.workflow.trigger
Class WorkflowStateService
java.lang.Object
com.axelor.workflow.trigger.WorkflowStateService
Manages the
MetaWorkflowState rows of once and timer workflows, unique on
(workflow, recordId). Tenants live in separate databases, so there is no tenant column.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA concurrent caller created this state row first: a benign race whose loser rolls back and skips. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(WorkflowEvent event, MetaWorkflow def, WorkflowPlan.StartPlan start) Arm a timer workflow: record when and until when, opening a new episode.claimOnce(WorkflowEvent event, MetaWorkflow def) Claim the once budget for a record: the claimed row, now running, or null when the budget is spent or a run is in flight.voiddeactivate(WorkflowEvent event, MetaWorkflow def) Disarm a time workflow when its condition goes false; the episode resets.voidmarkDone(MetaWorkflowState state) Finalize a successful once run: the budget is consumed.voidmarkOnceDone(WorkflowEvent event, MetaWorkflow def) Spend the once budget directly, for an ungated programmatic run.voidrelease(MetaWorkflowState state) Release a claim after a failed run so the once budget is preserved.
-
Constructor Details
-
WorkflowStateService
public WorkflowStateService()
-
-
Method Details
-
claimOnce
Claim the once budget for a record: the claimed row, now running, or null when the budget is spent or a run is in flight. Taken under a row lock, so a concurrent caller waits and then skips. -
markOnceDone
Spend the once budget directly, for an ungated programmatic run. -
markDone
Finalize a successful once run: the budget is consumed. -
release
Release a claim after a failed run so the once budget is preserved. -
activate
Arm a timer workflow: record when and until when, opening a new episode. -
deactivate
Disarm a time workflow when its condition goes false; the episode resets.
-