> -----Original Message-----
> From: Radhakrishnan, Sanjay (c)
> [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 07, 2000 1:50 PM
> To: [EMAIL PROTECTED]
> Subject: Controlling Threads in Servlets/JSP
>
>
> I am writing a servlet/JSP which spawns three java threads
> and has to wait for the 3 threads to finish processing before
> sending the results got from the threads to the client browser.

this sounds like a job for a concurrent construct called a barrier.
a barrier serves as a rendezvous point for some number of threads.

doug lea has an implementation of barriers in his "concurrent"
package; visit
http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.h
tml
for more info.

alternatively, and less elegantly (or maybe if you don't control
the nature of the threads), you could just do successive join()s
on the three threads you launch.  ugh.  8^)

hth,
p

--
// Paul Holser -- mailto:[EMAIL PROTECTED]
// ObjectSpace, Inc. -- http://www.objectspace.com
// 14850 Quorum Dr. Ste. 500, Dallas TX 75240 USA
// 972.726.4560 -- 1.800.OBJECT1 x4560

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to