Re: reuse a thread which is no longer "alive"

From: Kai Grossjohann (kgrossjo_at_eu.uu.net)
Date: 02/26/04


Date: Thu, 26 Feb 2004 09:38:21 +0100


"sayoyo" <dontwantspam@yahoo.com> writes:

> Is there some way that we can reuse a thread by replacing the runnable
> object of the thread? like a thread is not "alive" anymore, then we remove
> the runnable object(is it possible????) and then run it again.

There is a util-concurrent Java package which provides a thread pool
class. You hand a runnable to the thread pool, and it will look for
an unoccupied thread to execute that runnable. When the runnable is
done, the thread becomes available again.

Google for "util-concurrent".

Kai



Relevant Pages