This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm creating 3 threads for mini Web-crawler. When 3 threads created, main thread is continuing its job and terminated. I want main thread to process some tasks after child's executed(while sleeping). What I mean is,
1) Main thread created 3 threads.(Main thread should sleep, after creating child's)
2) 3 threads are crawled some pages and gone to sleep.
3) Now, I want main thread to wake-up and do some tasks.
4) Again main thread should go to sleep and 3 child's should wake-up.
Here, I don't know how to wake-up main thread, when all child's are sleeping...
Or if this is a cycle where the main thread gathers pages to process and the child threads process them, then you might consider using an Executor / ThreadPool. See this part of the tutorials: http://docs.oracle.com/javase/tutorial/essential/concurrency/executors.html. Basically, you make a ThreadPool with 3 threads. The main thread submits three tasks, uses the Futures to wait for them to complete. Submits the next group of tasks, and repeat until done.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Main thread is terminated, After threads all threads initialized.