Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join vs wait/notify

 
Laiq Ahmed
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please comment on my following understanding:

In context of threading, I am confused about join() and wait-notify mechanism. I believe both are used to halt one thread (say ThreadA)
so the other thread (say ThreadB)can finish the job. Assume ThreadB is a pre condition for ThreadA. In this case we may use threadBObj.join();
from threadAObj executing code or we may use wait/notify mechanism. wait/notify requires synchronization blocks so I would say that might
complicate things.
 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Laiq Ahmed wrote:Please comment on my following understanding:

In context of threading, I am confused about join() and wait-notify mechanism. I believe both are used to halt one thread (say ThreadA)
so the other thread (say ThreadB)can finish the job. Assume ThreadB is a pre condition for ThreadA. In this case we may use threadBObj.join();
from threadAObj executing code or we may use wait/notify mechanism. wait/notify requires synchronization blocks so I would say that might
complicate things.


check this.

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