开发者

Is Workflow Foundation StateFinalizationActivity blocking a thread?

开发者 https://www.devze.com 2022-12-12 13:18 出处:网络
This is the scenario: I have a State Machine Workflow using ManualWorkflowScheduler. Say there are 2 state开发者_JAVA百科s: State1 and State2. State1 contains an EventDrivenActivity1 that has a SetSt

This is the scenario:

I have a State Machine Workflow using ManualWorkflowScheduler. Say there are 2 state开发者_JAVA百科s: State1 and State2. State1 contains an EventDrivenActivity1 that has a SetStateActivity1 moving the workflow from State1 to State2. State1 also has a StateFinalizationActivity1.

So my question is:

When an event is raised and SetStateActivity1 executes and changes the state of the workflow to State2, is StateFinalizationActivity1 executed on the same thread (as part of the call) as the method that raised the event causing state change (meaning - does the caller method have to wait until both sequences of EventDrivenActivity1 and StateFinalizationActivity1 executes, or it will return after EventDrivenActivity1 is executed and StateFinalizationActivity1 is going to be executed after the return)?


The use of the word "Finalization" I guess might cause some to think of the CLR finalization which would run on a different thread. However this is very different concept.

When a SetStateActivity is hit the following sequence happens:-

  • other currently executing activities in the current state will run any activities in their Cancel handling.
  • the activities in the StateFinalization will execute
  • the state is transitioned to the new state
  • any activities in the new states Initialization Activity will run
  • the Event activity in the states body is entered.

All of the above operates in sequence on the current thread.


When using the ManualWorkflowScheduler everything that can be executed will on the current thread. So the workflow will continue and run all the way until its is in the next state and idle.

0

精彩评论

暂无评论...
验证码 换一张
取 消