Maayan Hope
Maayan Hope

Reputation: 1611

Preventing Spring State Machine from doing actions in parallel mode

We have a complex spring state machine

On transition from state to state we do "actions"

We noticed that sometimes the actions are done on "parallel" threads and not on the thread that sent the triggering event

What is the logic for exiting to parallel execution (new thread)?

Can we control this? prevent this?

On older versions of Spring State Machine we could provide our own Executor but now this option is not available anymore

we have seen this configuration option but it has no effect in our case

regionExecutionPolicy(RegionExecutionPolicy.SEQUENTIAL);

Thanks

Upvotes: 0

Views: 56

Answers (1)

Maayan Hope
Maayan Hope

Reputation: 1611

Ok, I think I found the reason for seeing threads that run in "PARALLEL"

This happens when the State Machine is using a transition driven by "timerOnce"

and().withExternal()
.source(States.SOME_STATE).target(SipStates.OTHER_STATE)
.timerOnce(10000)
.action(doSomethingAction)

In this case in order to do something "later" the state machine must to in on a new thread thus we see the parallel thread name

Upvotes: 0

Related Questions