I am trying to build an implementation of the ExecutorService
, let\'s call it SequentialPooledExecutor
, with the following properties.
If you want to execute your task sequentially simply create a ExecutorService with only one thread thanks to Executors.newSingleThreadExecutor().
If you have different type of tasks and you want to execute only the tasks of the same type sequentially, you can use the same single threaded ExecutorService
for the same type of tasks, no need to reinvent the wheel.
So let's say that you have 1 000
different type of tasks, you could use 200
single threaded ExecutorService
, the only thing that you need to implement yourself is the fact that you always need to use the same single threaded ExecutorService
for a given type of task.