There are a huge amount of tasks. Each task is belong to a single group. The requirement is each group of tasks should executed serially just like executed in a single thread an
Actor is also another solution for this specified type of issues. Scala has actors and also Java, which provided by AKKA.