>> If I understand the issue, I think you mean that these classes are not >> guaranteed to execute their subtasks using the same ExecutorService that >> they were given. Is that correct? > > No it is a little more than that. When a standard Task is created, it > either uses a default ExecutorService or the one provided to it. This > cannot be changed later. > > TaskGroup & TaskSequence extend Task and also accept an > ExecutorService, but this is never used (no call to > getExecutorService()) > > In their execute() methods, they both just iterate over the added > Tasks and call > ((Task<Object>)task).execute(taskListener); > on each Tasks. > > This will execute each Task using its internal ExecutorService, and > not the one supplied to the TaskGroup/TaskSequence.
Right. That's what I said. ;-) The ExecutorService given to TaskGroup and TaskSequence is used to execute the root task (the group or sequence). It just isn't used to execute the sub-tasks. If you want the sub-tasks to use the same executor service, you can just pass that service instance to the sub-task constructor. > I thought that I would be able to do something like this to execute an > arbitrary group of Tasks in parallel, but limited to only 3 being > started at any given moment. > > TaskGroup taskGroup = new TaskGroup(Executors.newFixedThreadPool(3)); If you pass the fixed thread pool service to each of your individual tasks, you will get the behavior you want. You probably don't want to use the same service for the root task, since that would require a fourth thread. G