I've done a similar thing with one of our Webware applications. I started t=
he thread in my webware servlet. Once I started the worker thread, I set a =
refresh header in the servlet to keep reloading the page (say, every 5 seco=
nds). The main function for the thread was one of the methods of my servlet=
class, so I was able to use a session variable to keep track of the status=
of my worker thread. When I created the worker thread, I set some session =
variables to let me know if it had been created and started and whatnot. Th=
ose variables prevented me from trying to recreate the thread on each page =
refresh. Now, I had a lot of control over the environment for this process,=
so I'm not sure how well this would scale, but it worked for me.
If you are interested, I could probably post some example code.
On Fri, 21 May 2004 11:25:56 -0400
"Ian Sparks" <Ian.Sparks@...> wrote:
> Hi all,
> I have a situation where I need to submit long-running tasks via a Webwar=
e application. These tasks are CPU intensive and can take up to a few minut=
es to complete.
> What I do at the moment is spawn a thread from the servlet to do the proc=
essing and let the servlet return to do more work.
> This works OK but I'd like to find out the status of those jobs and I'd a=
lso like to make sure that I'm not trying to do several of these tasks at o=
nce because they will bring the sever to a crawl..
> So I was thinking of creating a queue and having a worker thread busy awa=
y on it, reporting its progress back to the application in some way.
> Has anyone done this with webware? Advice? Pitfalls to avoid?
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market... Oracle 10g.=
> Take an Oracle 10g class now, and we'll give you the exam FREE.
> Webware-discuss mailing list