You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Filip Rachunek <fi...@yahoo.com> on 2002/10/05 08:55:08 UTC

I need to run a servlet periodically

Hello,
is it possible to have a servlet in Tomcat container
which is invoked automatically each gived time period?
[e.g. each 10 minutes]  And I would also need this
special servlet to access other resources of my web
application [connection pool, ...].

Thanks.
Filip Rachunek


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: I need to run a servlet periodically

Posted by Malachi de AElfweald <ma...@tremerechantry.com>.
Unless you are just trying to do refresh, in which case you
could use the meta-tags to do auto-refresh and server-push.

If you were trying to do a servlet that managed something
always running, then you would want a daemon that could handle
live-updates.

Please be more clear on the usage.


Malachi


10/5/2002 3:47:59 AM, Nikola Milutinovic <Ni...@ev.co.yu> wrote:

>Filip Rachunek wrote:
>
>> Hello,
>> is it possible to have a servlet in Tomcat container
>> which is invoked automatically each gived time period?
>> [e.g. each 10 minutes]  And I would also need this
>> special servlet to access other resources of my web
>> application [connection pool, ...].
>
>You're making a mistake. A Java Servlet is a Java component that responds to a 
>web request. That's it - nothing more, nothing less, just what it is designed for.
>
>It is not designed to be a "cron job". Something like that doesn't belong to a 
>web application - or should we say, to the web GUI part of a web application. In 
>a full JEE application which has a web portal (like Tomcat), you would place 
>such a "cron job" somewhere other than a web interface. I'm not sure where, I'm 
>no expert on JEE (yet).
>
>This was like asking "can CGI script be configured to run at regular 
>intervals?". Of course you could run a cron job that would act as a web client 
>and send a request that would fire up that CGI or Servlet. But that is going 
>slightly around it. And doing it at the wrong point.
>
>Web applications are request driven application and should not be twisted into 
>something unnatural. Use a regular cron job for this.
>
>Nix.
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: I need to run a servlet periodically

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
Filip Rachunek wrote:

> Hello,
> is it possible to have a servlet in Tomcat container
> which is invoked automatically each gived time period?
> [e.g. each 10 minutes]  And I would also need this
> special servlet to access other resources of my web
> application [connection pool, ...].

You're making a mistake. A Java Servlet is a Java component that responds to a 
web request. That's it - nothing more, nothing less, just what it is designed for.

It is not designed to be a "cron job". Something like that doesn't belong to a 
web application - or should we say, to the web GUI part of a web application. In 
a full JEE application which has a web portal (like Tomcat), you would place 
such a "cron job" somewhere other than a web interface. I'm not sure where, I'm 
no expert on JEE (yet).

This was like asking "can CGI script be configured to run at regular 
intervals?". Of course you could run a cron job that would act as a web client 
and send a request that would fire up that CGI or Servlet. But that is going 
slightly around it. And doing it at the wrong point.

Web applications are request driven application and should not be twisted into 
something unnatural. Use a regular cron job for this.

Nix.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>