Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join method

 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There may be situations when the current thread's execution should be halted until another thread 'A' completes execution. This may be accomplished by invoking the join method on thread A. Using A.join() within a thread is tantamount to making the current thread sleep until thread 'A' completes execution.




http://www.edumax.com/java-basics-thread-join.html


I know how the join method works, But my questions which situation or scenario can happened in real world, that the usage of join method is needed?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your quote itself is a real time scenario. you will experience this when you work in muti threaded environment.
 
Jim Hoglund
Ranch Hand
Posts: 525
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An example would be a document to reformat and then print. Start the reformatting operation
in a thread and then launch a print thread. But have the print thread join the formatting thread.
The main thread can then go on to other tasks.

Jim ... ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic