Howdy,
In the general case, no there are no problems creating threads off of
your servlets to do background processing and other tasks.

If you're running inside a full J2EE container, there may be problems,
but I don't think that applies to your current situation.

I've seen/implemented a number of such things in various projects.  A
couple of things I've kind of noticed:

- If the report takes a "long", but not really long, e.g. 30-60 seconds
(this is subjective) time to run, you may just wish to skip JavaScript
stuff and put a notice on the link that generates the report that the
report may take up to a minute to generate.

- If you can predict what reports are needed ahead of time, you can
pre-create them and serve them up quickly to the users.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Wendy Smoak [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, February 20, 2003 3:03 PM
>To: '[EMAIL PROTECTED]'
>Subject: Okay for Servlet to start a new Thread?
>
>
>A coworker has a Struts app that gathers info and runs a report.  The
>report
>could take a long time to complete, so right now the user just sits at
the
>page that was "submitted" and it looks like nothing's happening.  He
wants
>to get something to the user immediately, and we're thinking of a page
that
>reloads itself (w/ JavaScript) until the report finishes.
>
>This seems to indicate that we need to kick the report off in a
separate
>Thread so that it can go do its thing while we continue on in the
Struts
>Action and forward to the JSP that will tell the user to be patient.
>
>Before we start down this road, is there any problem with creating a
Thread
>within a Servlet (Struts Action, actually)?  I haven't done much
concurrent
>Java programming, so I may be way off base and would appreciate being
told
>that sooner rather than later!
>
>--
>Wendy Smoak
>Applications Systems Analyst, Sr.
>Arizona State University PA Information Resources Management



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to