4 Replies Latest reply on Jun 28, 2011 4:20 AM by Bruce Cui

    How to Support/Enable Multi-threading in 5.1?

    Bruce Cui Newbie

      I'm looking to using jBMP5 to establish a series of backend batch processes, where multi-threading is one of the key elements. So when I found 5.0 did not support multi-threading, I was quite disappointed. But 5.1 gave me new hope. In the release announcement in the blog, I see the last enhanced feature is the support of multi-threading.


      But but, I found the thing wasn't quite like what I expected when I actually tested an example. In this example, a sub-process is embedded in a Multi Instance node, the "wait for completion" flag of the sub-process set to "false", and the "independent" flag to "true". Within the sub-process, there is a sefl-defined service task prints a line out on every 10 seconds.


      In my imagination, if multi-threading is fully supported, each round in the MultiInstance node should start one sub-process in a new thread and then move to the next round immediately. And the service task within each thread should print lines randomly. I think this is the essential meaning of the "wait for completion" flag.


      But the reality is, the service tasks run one by one exactly, no matter how long I slept between line printings. This result upset me very much.. Before I found this, I was thinking of launching subsequent processes by one heading process, and each subsequent one could launch their own subsequent ones, and all of them could run in parallel. But now I feel it not quite possible.


      I also did another testing with simple fork pattern. Again, unless I used timers in sub-paths, each path got executed exactly one by one no matter how many steps I put in each sub-path.



      So here are my questions:

      1. Am I wrong or 5.1 still doesn't support multi-threading?

      2. If I'm wrong, which I hope the same, how can I enable the supporting of multi-threading in my processes? Or is there a fixed pattern I need to abide by to make this happen?


      Looking forward to your kindly advice.


      Just found something more. When I tried to start two instances of a process which prints lines out in a loop, I found one instance could not start printing until the other one moved to sleep. And while any one of them was running, I even could not refresh the process list in console. This appears to me that even the console server itself is running all things in one single thread. This is a great tool. But I'm thinking maybe I'm using it in a wrong direction(batch process oriented). Bruce