hi all, I have 2 pools of threads
ioThreads = (ThreadPoolExecutor)Executors.newCachedThreadPool();
cpuThreads = (ThreadPoolExecutor)Executors.newFixedThreadPool(numCpus);
I have a simple web crawler that I want to create an iothread, pass it a url, it will then fetch the url and pass the contents over to a cpuThread to be processed and the ioThread will then fetch another url, etc...
At some point the IO thread will not have any new pages to crawl and I want to update my database that this session is complete. How can I best tell when the threads are all done processing and the program can be ended?