To execute multiple strategies in parallel from an activity
Procedure to execute multiple strategies in parallel from an activity. At this moment, execution time is too high and that must be reduced. Hence, the requirement to run two strategies in parallel.
The explanation for this behavior is as follows:
You must note that there is no issue running strategies in parallel as long as the external resources are referenced by the strategy also run in parallel.
Strategies are invoked from Activities using an Interaction rule. Run the activities in parallel using the following API calls:
- tools.getRequestor().queueBatchActivity(…) -> to start new thread
- tools.getRequestor().waitOnBatchActivity(…) -> wait for the thread to finish
You can store the thread returned by queueBatchActivity in a list and afterwards loop through the list.
Call waitOnBatchActivity to wait on them and join back on the main thread.
100% found this useful