| Author |
Multithreading doubt
|
nmohan kumar
Greenhorn
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 t3.so,in the servlet i have coded like,
t1.start();
t2.start();
t2.join();
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 running..how 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 . . .
|
BEE MBA PMP SCJP-6
|
 |
nmohan kumar
Greenhorn
Joined: Mar 01, 2010
Posts: 6
|
|
Thank you very much Jim.It worked fine.
|
 |
 |
|
|
subject: Multithreading doubt
|
|
|