Hi Ben,

Hi Ben,

Thanks for the response. I have a couple 
of questions.

1. Should I start the ThreadGroup as a "daemon"?  

2. Why should I start the threads in the init() method? 
I want to be able to run these threads anytime
I run my "LoadDatabaseServlet" (Unless of course
their are threads it is still running.) Isn't the init()
method only called once when JRUN does the servlet initialization.

Thanks:

Alex

-----Original Message-----
From: Ben Groeneveld [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 2:24 PM
To: JRun-Talk
Subject: Re: Background Thread Servlet Question


Alex, you can specify in the web.xml for the servlet to autoload when 
the container starts, and then start the threads in the init method.  To 
track your threads, first create a threadgroup, and start all your 
threads in that group.  Name each one, and then use a tool like 
OptimizeIt to track them.  OptimizeIt attaches nicely to a jrun 
container.  Be careful starting too many threads, you'll shoot yourself. 
 Most people don't realize they don't need 'em :)  Hope that helps, BenG.

RESTREPO, ALEXANDER G [Non-Pharmacia/1000] wrote:

>Hello:
>
>Does anyone have an example
>of a servlet which starts several threads
>in the background?
>
>I would also be interested in seeing how 
>I can monitor the threads the servlet
>starts. 
>
>For example let's say
>I have a LoadDatabaseServlet which starts
>5 threads.  
>
>The 5 threads are:
>
>1.  LoadEmployeeTableThread
>2.  LoadCountyTableThread
>3.  LoadZipTableThread
>4.  LoadAreaCodeTableThread
>5.  LoadPopulationTableThread
>
>I would like to monitor the status of
>the threads via the same servlet which starts
>the threads.  
>
>The status would be in the form:
>
>LoadEmployeeTableThread   has processed 121 records
>LoadCountyTableThread     has processed 131 records
>LoadZipTableThread        has processed 141 records
>LoadAreaCodeTableThread   has processed 151 records
>LoadPopulationTableThread has processed 161 records
>
>Once the threads are done the status would be:
>
>LoadEmployeeTableThread   is done processing
>LoadCountyTableThread     is done processing
>LoadZipTableThread        has processed 141 records
>LoadAreaCodeTableThread   has processed 151 records
>LoadPopulationTableThread has processed 161 records
>
>
>Any help would be greatly appreciated,
>
>Alex Restrepo
>

______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to