« Return to Thread: starting threads from web container

Re: starting threads from web container

by Tim Watts :: Rate this Message:

Reply to Author | View in Thread

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

 « Return to Thread: starting threads from web container