posted 17 years ago
I am not sure why you have insisted on using the same thread?
While using an executor, thread instance is not what a client must be bothered about, instead it should be worried about the runnable/callable that is submitted.
I would presume that the task(runnable/callable) that you will submit will have the id of the item that is to be processed and enough context information to process that item.
When the task gets invoked, it can look at the id and dispatch it to the appropriate class to execute it. This will all happen in the thread of the executor.
With this you can change the executor anytime you want and all the same task ids will be processed by a dedicated class concurrently.
Additionally, you can assign a priority to each task which you will not be able to do if you have different executors for every task id.
P.S. I think this is what Stan was referring to. isn't?
Hope it answers your question.
[ December 20, 2007: Message edited by: Nitesh Kant ]