I am running a for loop and at each iteration, I execute a SwingWorker in background (who lasts around 5 minutes). I have an attribute who is the number of Worker running in background at the same time.
The for loop has 100 iterations but I want only 5 simulutaneous SwingWorker running. How can I pause the loop iteration if the number of simulutaneous worker running if superior to 5 ? how can I resume it when it becomes lower ?
Thank you.