Your idea basically sounds. However, instead of creating threads directly or indirectly through some ThreadManager of your own design, use the Executor package from Java concurrency. He does everything you need, and other people have already taken the time to write and debug it. The worker manages the task queue, so you also do not need to worry about ensuring the thread safety queue.
There is no difference between Callable and Runnable, except that the former returns a value. Artists will process both.
Itโs not clear to me whether you plan to take the step of preparing a separate task for analysis or turn it into one of them, and this task will not be solved for the other task of analysis halfway. I canโt think of any reason to strongly prefer each other, but this is a choice that you should think about.
source share