All,
I have a scenario wherein I invoke a small custom
java application in a for loop from another app.
The for loop can contain 100k elements and there is no inter-dependency b/w the elements contained in the list so processing these elements in parallel should not cause any functional issues. Currently the program
unit runs synchronously where we start record 2 after record 1 finishes so on and so forth.
How can I spawn multiple threads within this for loop so at a time I can have 10 or more such elements being executed in parallel. I feel this way we can utilize resources optimally and increase the overall performance by reducing the time it takes to process 100k records.
Please suggest the best practice here. Most threading examples I saw had some counter based scenario which did not deem fit to the scenario I am having.
Thanks.