I have an object with a method named StartDownload()
, that starts three threads.
How do I get a notification when each thread has finished executing?
You could also use the Executors
object to create an ExecutorService thread pool. Then use the invokeAll
method to run each of your threads and retrieve Futures. This will block until all have finished execution. Your other option would be to execute each one using the pool and then call awaitTermination
to block until the pool is finished executing. Just be sure to call shutdown
() when you're done adding tasks.