aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes returning data from a running thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "returning data from a running thread" Watch "returning data from a running thread" New topic
Author

returning data from a running thread

fadi mujahid
Greenhorn

Joined: Oct 14, 2002
Posts: 28
Hello
How do u return data from a running thread? run() method returns void, so you cannot return your data through it.
Any thought would be appreciated
Thanks
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
If you make your own subclass of Thread (let's call it MyThread), you can put whatever data you want in the MyThread object. Then, after you join the thread, look at that data.


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi Fadi,
check whether the join() method of the Thread class can help you to solve your problem.


Mag
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi Fadi,
it seems that I didn't get your question right. Here's another try: You may want to read the first draft of my essay on exactly this question at http://www.mhoehme.de/java/threads.html.
Any comments are welcome!
[ November 04, 2002: Message edited by: Mag Hoehme ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: returning data from a running thread