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.
- Posted by: david frost
- Posted on: September 11 2001 02:45 EDT
Any info, tips, discussio would be appreciated.
- Design pattern to handle threading in J2EE context? by Henrik Engstrom on September 24 2001 10:54 EDT
"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: