🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14499

Re: Java Multithreading

#14499
From: Kobus du Toit
Date: Fri, 27 Aug 1999 00:00
42 lines
2089 bytes
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: <37C66E98.72606052@iname.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7q49s5$p6m12@forums.borland.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: Kobus du Toit <battlezone@iname.com>
Subject: Re: Java Multithreading
Date: 1999/08/27
Message-ID: <37C66E98.72606052@iname.com>
X-Deja-AN: 517747991
Content-Transfer-Encoding: 7bit
References: <7q49s5$p6m12@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Reply-To: battlezone@iname.com
Newsgroups: borland.public.jbuilder.java.language