Suppose I need to process files in a given folder in parallel. In Java I would create a FolderReader thread to read file names from the folder and a pool of FileProcessor threads. FolderReader reads file names and submits the file processing function (Runnable) to the pool executor.
In Scala I see two options:
- create a pool of
FileProcessoractors and schedule a file processing function withActors.Scheduler. - create an actor for each file name while reading the file names.
Does it make sense? What is the best option?