Hey henry,
thanks for clearing that up.
Yes. Previous submitted tasks are tasks submitted into the pool prior to the shutdown call. And they will be executed before the pool threads terminates.
So that means then that any thing in the queue is discarded. Understand
This method simply waits for termination -- whether termination occurs after the queue is drained or not depends on whether you requested an orderly shutdown or not.
this confuses me from what you said above. shutdown() is an orderly shutdown. it sounds like if do an request for an orderly shutdown through shutdown() that awaitTermination will wait until the queue is drained then terminate the executor? so it sounds like from your quote above that shutdown() will finish all tasks in the pool but then awaitTermination will say "hey shutdown do not terminate until everything in the queue is finished". correct?
an example would help
There are 10 tasks in the queue and 5 tasks in the thread pool. then shutdown() is called. then awaitTermination method is called. the 5 tasks in pool will be let finished and the code will wait at the awaitTermination line until all 5 tasks are finished then the executor will be terminated. so the 10 tasks in the queue will be discarded and never run. correct?
if this is so then i would have to do some thing like this
thanks for your help
Also serached the internet this morning for understanding the api. This post came up first in google. that was fast
http://www.google.ie/#hl=en&biw=1600&bih=990&q=threadpoolexecutor+shutdown+when+queue+is+empty&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=ff8be12b9b06f6de