Looks like you've got the right idea.  It doesn't matter how many Runnables you've handed over to the ExecutorService to run or how big a thread pool you've allocated, you only need to call shutdown() once.  That will allow all tasks to complete but will not allow you to add any new ones.  You may want to call 

try {
    executorService.awaitTermination(5, TimeUnit.MINUTES);
} catch (InterruptedException e) {
    // do stuff
}


to block while all tasks are completed depending on your usage scenario.

If you want to shutdown and attempt to kill all running tasks, instead call the shutdownNow() method.  Note that there is no guarantee that it will be able to interrupt running tasks.

How to shutdown many instances of the ExecutorService Runnables?
From what I can see on the web, this is a fairly common complaint, but answers seem to be rarer. The problem is this:

We have a number of Excel VBA apps which work perfectly on a number of users' machines. However on one machine they stop on certain lines of code. It is always the same lines, but those lines seem to have nothing in common with one another.

If you press F5 (run) after the halt, the app continues, so it's almost like a break point has been added. We've tried selecting 'remove all breaks' from the menu and even adding a break and removing it again.

We've had this issue with single apps before and we've 'bodged' it by cutting code out of modules, compiling and then pasting it back in etc.

The problem now seems to relate to Excel itself rather than a single .xls, so we're a little unsure how to manage this.

Any help would be gratefully received :)

Thanks,

Philip Whittington
