A value that is local to a single workflow execution. So it can act as a
global variable
for the workflow code. For example the
Workflow.isSignaled()
static method returns the
correct value even if there are multiple workflows executing on the same machine simultaneously.
It would be invalid if the
signaled
was a
static boolean
variable.
public class Workflow {
private static final WorkflowLocal<Boolean> signaled = WorkflowLocal.withInitial(() -> false);
public static boolean isSignaled() {
return signaled.get();
}
public void signal() {
signaled.set(true);
}
}