You have a standard model 2 (jsp/servlet/ejb model) where the backend process, either servlet or ejb, does a series of jobs. Let assume there are 3 jobs, A, B and C. A takes 5 seconds, B takes 10 and C takes 15. None of the jobs are dependent upon each other and do not need to be run serially. The front end however needs data from all 3 jobs but you want the jobs to run concurrently so that the longest amount of time you would have to wait would be 15 seconds. How would one go about handling this? I'm not sure about threading at the servlet level but I know it is not recommended at the EJB level.
Any info, tips, discussio would be appreciated.
-Dat
-
Design pattern to handle threading in J2EE context? (1 messages)
- Posted by: david frost
- Posted on: September 11 2001 02:45 EDT
Threaded Messages (1)
- Design pattern to handle threading in J2EE context? by Henrik Engstrom on September 24 2001 10:54 EDT
-
Design pattern to handle threading in J2EE context?[ Go to top ]
- Posted by: Henrik Engstrom
- Posted on: September 24 2001 10:54 EDT
- in response to david frost
"Any servlet can create a thread during its life-time. Because when your inside a servlet you have full power of the JVM at your fingertips. However, with the creation of threads also comes the responsibility of carrying out its timely destruction. In the servlet model, the destroy() callback provides a useful place for checking and removing secondary threads created by your servlets."
For more information see:
http://www.acknowledge.co.uk/ejava/servlet_seminar/servlets/threading.html
HTH
/Henrik Engstrom