I'm wondering how could I, without doing my own implementation of reporting using blocking queues and similar, as easily as possible implement the following scenario:
I have K * N tasks, every batch of N tasks is a bit different.
- Submit the first batch of N tasks (the work is done concurrently on every task)
- When any of the tasks finishes submit a new one (taking it from the second batch)
The second point is repeated until all of the tasks are finished.
Should I use a CyclicBarrier and submit a task when there's one thread waiting? I guess I'd have to use a blocking queue to guarantee that I won't submit the same task twice.
Aucun commentaire:
Enregistrer un commentaire