1 Reply Latest reply on Jul 13, 2007 7:39 AM by tom.baeyens

    Spawning threads of control?

    kevin.l.wilson

      I am trying to create a node in which we can start N parrallel threads of execution in a WF. I can create the new context and leave the node N times. However, this still comes to a sequntial execution since the Node.leave() runs in the same thread.

      1) I know I could start my own thread and call leave node on the separate threads. (However, this may have other consequences (non-threadsafe) method calls etc.)

      Is there a recommended way to start up several paths of execution? Should I integrate some state node in which a time will release the node in its own thread. What is the recommended method to establish multiple threads of execution?

      Kevin

        • 1. Re: Spawning threads of control?
          tom.baeyens

          think about what part of the graph you want to do in 1 transaction. where would you ideally put the transaction boundaries.

          spawning threads doesn't really help if you have to synchronize access to the jdbc connection after all.

          and usually the number of computations done in executing the different concurrent branches until a waitstate is reached, is neglectable.

          'until a wait state is reached' is crucial here. since that is when the leaveNode should return.

          asynchronous continuations can be used to demarcate transactions. this also leads to a wait state and will also cause the leaveNode to return.

          HTH