FYI, You should also be aware of the Java 1.5 preview in this area: http://gee.cs.oswego.edu/dl/concurrency-interest/index.html
Gary > -----Original Message----- > From: Serge Knystautas [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 19, 2003 07:30 > To: Jakarta Commons Users List > Subject: Re: Question on Threadpool > > David J. M. Karlsen wrote: > > Also I do not understand the DefaultThreadPool(int size) constructor: > > it calls startThread size times. startThread then does: > > > > > > Thread thread = new Thread( this ); > > thread.start(); > > return thread; > > > > so the DefaultThreadPool replaces it's Thread object size times - what's > > the point in that? > > > > what am I missing out on? > > I think reading up on the Thread class and Runnable interface will help > you understand what's going on here. The phrase "replace it's Thread > object" doesn't really make any sense. > > The thread pool is creating a new Thread object that will call the > DefaultThreadPool's run() method. This run() method takes your worker > tasks (that you handed the pool using invokeLater()), and runs that > worker task. This run() method loops until you call stop() on the > ThreadPool. > > If you want your stand-alone java app to stop, you'll need to call > stop() on the pool. Another alternate is to modify the > DefaultThreadPool (or create another thread pool implementation) that > creates these threads as daemon's, as the JVM will exit if only daemon > threads are running. > > -- > Serge Knystautas > President > Lokitech >> software . strategy . design >> http://www.lokitech.com > p. 301.656.5501 > e. [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]
