Article View: borland.public.jbuilder.java.language
Article #14508Re: Java Multithreading
From: Kevin D
Date: Fri, 27 Aug 1999 00:00
Date: Fri, 27 Aug 1999 00:00
61 lines
2388 bytes
2388 bytes
Yes Thanks. I have gotten that far. My problem is that after the thread has completed executing its run method, it terminates. How would I cause some method within my GUI to fire up. Can I use a event or an exception of some sort? KD Kobus du Toit wrote in message <37C66E98.72606052@iname.com>... >I don't know, but maybe a thread calls the stop method when it finishes. This >is some info > >To start a thread, simply call its start() method. If you try to call a >thread's start() method more than >once, an exception will be thrown. To stop it, you can either use stop() or >destroy(). Stop() terminates >the thread and throws a ThreadDeath exception to the thread. This is necessary >because the thread might >be doing something that, if interrupted, may cause unpredictable results; for >example, it could be in the >middle of modifying a file or some other system resource. To avoid problems of >this nature, the >ThreadDeath exception should be caught in order to perform any necessary >cleanup before the thread >terminates. > >Be careful when catching the ThreadDeath exception. When stop() throws a >ThreadDeath exception and >you catch it, you must rethrow it in the catch block. If you do not, the thread >will never stop! > >Another way to stop a thread is to call its destroy() method. This method, >although not currently >implemented in the JDK 1.1, does not throw a ThreadDeath exception when called > > >Kobus > >Kevin D wrote: > >> I need to be able to catch when a thread has finished executing. >> >> I have a frame which starts two threads, then control returns to the frame. >> These threads move/message data from one database to another. >> >> From within the frame how can I capture the fact that a thread has died, >> most likely due to an error. >> >> Thanks Much >> >> KD >
Technical Details
Message-ID:
<7q62fq$r9o4@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7q49s5$p6m12@forums.borland.com> <37C66E98.72606052@iname.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,513bff9c58505db2 X-Google-Attributes: gidf74b3,public From: "Kevin D" <kevind@saccapital.com> Subject: Re: Java Multithreading Date: 1999/08/27 Message-ID: <7q62fq$r9o4@forums.borland.com> X-Deja-AN: 517781672 References: <7q49s5$p6m12@forums.borland.com> <37C66E98.72606052@iname.com> Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.language