Package com.axelor.workflow.exec
Class WorkflowReentrancyGuard
java.lang.Object
com.axelor.workflow.exec.WorkflowReentrancyGuard
Guards against runaway cascades: a run may save records whose events start more runs. A context
opened around the dispatch spans the whole chain, rejecting runs past a depth limit and any run
whose key (
tenant|model|jsonModel|name|recordId|cause) is already active in it. Keys
clear when the outermost context closes.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidenter()Open (or descend into) a cascade context; pair withexit()in a finally block.voidexit()Leave a cascade level; clears all keys once the top-level context unwinds.Build the execution key for a run; pass totryAcquire(String).intmaxDepth()The configured cascade depth limit.booleantryAcquire(String key) Reserve a run's key; false past the depth limit or when the key is already active.
-
Constructor Details
-
WorkflowReentrancyGuard
public WorkflowReentrancyGuard()
-
-
Method Details
-
enter
public void enter()Open (or descend into) a cascade context; pair withexit()in a finally block. -
exit
public void exit()Leave a cascade level; clears all keys once the top-level context unwinds. -
tryAcquire
Reserve a run's key; false past the depth limit or when the key is already active. Always true outside a guard context. -
key
public String key(String tenant, String model, String jsonModel, String name, Long recordId, TriggerKind cause) Build the execution key for a run; pass totryAcquire(String). -
maxDepth
public int maxDepth()The configured cascade depth limit.
-