• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

How to skip or stop when some thread joins the running thread?

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Assume we have created huge threads in our application....

Sometimes another may join with the running thread...

In certain cases, we need to allow the thread to be joined, in certain cases we don' to allow the other thread to join...

How can we achieve or make sure that no other thread can be joined in the running thread?

Thanks
 
Saloon Keeper
Posts: 14682
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your requirement is very vague and it sounds like there is a better way to do whatever it is you REALLY want to achieve.

Can you describe your use case in more detail? Why would you want to do this?
 
Sheriff
Posts: 27529
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If thread A calls the join() method of thread B, all that means is that thread A will then wait until thread B is complete. I can't imagine why that would be a problem and why you would want to disallow that. After all it has no effect on what thread B does.

So I'm agreeing with Stephan.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic