aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interrupting a Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interrupting a Thread" Watch "Interrupting a Thread" New topic
Author

Interrupting a Thread

Paulo Freitas
Greenhorn

Joined: Feb 26, 2003
Posts: 17
How can a Thread y interrupt a Thread x, if was x that has started Thread y?
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
X and Y are subclasses of Thread. An X object creates a Y object and starts the thread. The X object passes a reference to itself (a Thread object) to the Y object in the constructor.

X and Y implement Runnable. An X object creates a Y object. X passes a reference to the current thread in the constructor. X creates a Thread object and passes the Y object to the Thread object. X starts the thread.
Paulo Freitas
Greenhorn

Joined: Feb 26, 2003
Posts: 17
Thanks a lot Marlene. That was exactly what I wanted to know.
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
And thank you Paulo for letting me know I answered the question you were asking.
bengt hammarlund
Ranch Hand

Joined: Oct 17, 2003
Posts: 78
Hi Marlene! I miss you!
Good news: I already got a job, and a good one. More details if you whant, email-me!
PS.: Paulo, are you from Brazil? I am Brazilian myself, and your name sound familiar.


<b><i>Bengt Hammarlund</i><br />� Sun Certified Java Programmer</b>
Paulo Freitas
Greenhorn

Joined: Feb 26, 2003
Posts: 17
Right on the spot!!! I am brazilian(SP), but I have been living in Toronto/Canada for almost 2 years.
 
Consider Paul's rocket mass heater.
 
subject: Interrupting a Thread