Article View: borland.public.jbuilder.java.api
Article #177Re: Why can I not restart a thread which had stopped?
From: David Orriss, Jr. [TeamB]
Date: Mon, 26 Jul 2004 17:59
Date: Mon, 26 Jul 2004 17:59
77 lines
2862 bytes
2862 bytes
You've asked about this same issue in the .language group. Please do
not multipost. It's a violation of Borland Newsgroup policies..
http://info.borland.com/newsgroups/guide.html#crossposts
On 24 Jul 2004 00:02:14 -0700, "jinxiaojin" <jinxiaojin@126.com>
wrote:
>
>I wrote follow codes,and found this thread only run once
>I hope this thread run twice,and i think the program will print:
>Thread is running
>Thread exit
>Thread is running
>Thread exit
>
>In fact ,it is :
>Thread is running
>Thread exit
>
>
>
>
>public class ThreadTest2 {
> MyThread mythread;
> /** Creates a new instance of ThreadTest2 */
> public ThreadTest2() {
> mythread = new MyThread();
> test();
> }
>
> private void test() {
> mythread.start();
> try {
> Thread.sleep(1000l);// mythread has finish his job
> }
> catch(Exception ex) {
> ex.printStackTrace();
> }
> mythread.start();
> }
>
> /**
> * test main method
> */
> static public void main(String[] args) {
> ThreadTest2 test = new ThreadTest2();
> }
>}
>
>class MyThread extends Thread {
> public MyThread() {
>
> }
>
> public void run() {
> System.out.println("Thread is running");
> System.out.println("Thread exit");
> }
>}
--
David Orriss Jr. *TeamB*
http://www.davenet.net/
* Please limit all responses to the newsgroups. Thanks! *
Got a JBuilder website? Join the JBuilder Netring! Check out
http://www.davenet.net/jbwebring/jbwebring.htm for more information!
My blog: http://mywebpages.comcast.net/daorriss/
Save yourself some time and check these sites:
Borland Newsgroup Search:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's Faq-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Technical Details
Message-ID:
<3fhag01ego1rgqrih2vd39lvp3621r24pe@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41020976$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1089d0,643a33a4ab191a18 X-Google-Attributes: gid1089d0,public X-Google-Language: ENGLISH,ASCII-7-bit From: "David Orriss, Jr. [TeamB]" <jbuilder_man@davenet.net> Newsgroups: borland.public.jbuilder.java.api Subject: Re: Why can I not restart a thread which had stopped? Date: Mon, 26 Jul 2004 10:59:53 -0700 Message-ID: <3fhag01ego1rgqrih2vd39lvp3621r24pe@4ax.com> References: <41020976$1@newsgroups.borland.com> X-Newsreader: Forte Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.136.0.225 X-Trace: newsgroups.borland.com 1090864791 67.136.0.225 (26 Jul 2004 10:59:51 -0700) Lines: 77 X-Authenticated-User: daorriss Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail