« Return to Thread: starting threads from web container

Re: starting threads from web container

by Christopher Mawata :: Rate this Message:

Reply to Author | View in Thread

Not clear what you mean by
...
the servlet will handle requests when I know
that there will never be any
...
The overhead due to the more complex life-cycle should be trivial if
indeed the servlet has no code except in init()
Chris

-----Original Message-----
From: Tim Watts <timtw@...>
To: ajug-members@...
Date: Mon, 13 Apr 2009 23:40:30 -0400
Subject: Re: [ajug-members] starting threads from web container

Hi,

See ServletContextListener as well as the <listener> tag. This assumes you're
running in a container that supports at least the servlet 2.3 spec.


On Monday 13 April 2009 7:42:26 pm J. Talafous wrote:

> I want to have a background thread that is crunching data in the
> background of my web app.
>
> I am aware of <load-on-startup/> in the deployment descriptor of a web
> app.  I could start the thread in one of these servlets that load on
> startup.  But this doesn't seem proper... the servlet will handle
> requests when I know that there will never be any.  It is extra
> overhead that goes to waste.
>
> It seems that there would be hooks some where in the web container
> that I could use to create POJOs and they could in turn start the
> thread.  Are there any, especially specified in web.xml?
>
> _______________________________________________
> ajug-members mailing list
> ajug-members@...
> http://www.ajug.org/mailman/listinfo/ajug-members

--
I suppose that I shall have to die beyond my means.
 -- Oscar Wilde, upon being told the cost of an operation


_______________________________________________
ajug-members mailing list
ajug-members@...
http://www.ajug.org/mailman/listinfo/ajug-members




_______________________________________________
ajug-members mailing list
ajug-members@...
http://www.ajug.org/mailman/listinfo/ajug-members

 « Return to Thread: starting threads from web container