File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Multithreading doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Multithreading doubt" Watch "Multithreading doubt" New topic

Multithreading doubt

nmohan kumar

Joined: Mar 01, 2010
Posts: 6
i have coded 3 thread classes.The first two thread classes do file processing and the last one interacts with Beyond compare.let s say t1,t2 and,in the servlet i have coded like,


i tried this..and it worked out..can someone explain me wat is exactly happeing ,when the above code is being run?

and then t i want the t3 to be run after t1 and t2 finish can i make it?..
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
From your current thread, you created t1 and t2 and
told the JVM to start them both. Then, with t2.join()
you paused the current thread. It will start again
when t2's run() method has completed.

From your current thread, you can also do a t1.join().
So when your thread runs again, both t1 and t2 will
have completed and you can issue a t3.start().

Jim ... ... Oh yes - and welcome to the Ranch . . .

nmohan kumar

Joined: Mar 01, 2010
Posts: 6
Thank you very much Jim.It worked fine.

I agree. Here's the link:
subject: Multithreading doubt
It's not a secret anymore!