You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Artur Rataj <ar...@gmail.com> on 2006/02/22 16:15:58 UTC
A simple question about creating a thread in Tomcat app
Hello!
I would like, just after tomcat starts, to create a new thread. Where
can I put the code that starts it? I do not want to wait with starting
the thread until some servlet is needed.
Best regards,
Artur
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: A simple question about creating a thread in Tomcat app
Posted by Artur Rataj <ar...@gmail.com>.
I had some problems with the thread run in init(), that I described in
the thread `STrange problem with a thread made in Servlet.init()'. Now
I use the listeners with both startup/shutdown of the thread.
Best regards,
Artur
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: A simple question about creating a thread in Tomcat app
Posted by Artur Rataj <ar...@gmail.com>.
Thanks for help,
Artur
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: A simple question about creating a thread in Tomcat app
Posted by Edoardo Panfili <ed...@aspix.it>.
Artur Rataj ha scritto:
> Hello!
>
> I would like, just after tomcat starts, to create a new thread. Where
> can I put the code that starts it? I do not want to wait with starting
> the thread until some servlet is needed.
>
can you use somethings like:
<servlet>
<servlet-name>ServerInit</servlet-name>
<servlet-class>argentaroggia.servizi.ServerInit</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
in you web.xml
--
edoardo@aspix.it
AIM: edoardopn
Jabber: edoardopa@talk.google.com
tel:075 9142766
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: A simple question about creating a thread in Tomcat app
Posted by David Smith <dn...@cornell.edu>.
Can you? Yes.
The method depends on your version of tomcat. Older tomcat (sorry, I
don't remember what version) versions used to require you to add
<load-on-startup>1</load-on-startup> to a servlet definition and have
the servlet do this work for you. Newer tomcats (at least version 5.0
and 5.5, don't know about 4.1.x) allow you to implement a
ServletContextListener for better management including being able to
close down the thread when the context is stopped.
--David
Artur Rataj wrote:
> Hello!
>
> I would like, just after tomcat starts, to create a new thread. Where
> can I put the code that starts it? I do not want to wait with starting
> the thread until some servlet is needed.
>
> Best regards,
> Artur
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
--
David Smith
Network Operations Supervisor
Department of Entomology
Cornell University
2132 Comstock Hall
Ithaca, NY 14853
Phone: (607) 255-9571
Fax: (607) 255-0940
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org