tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Parsons <>
Subject Re: How to run servlet for every 30 minutes in Tomcat 4.1.30
Date Tue, 21 Dec 2004 22:59:36 GMT
At 05:37 PM 12/21/2004, you wrote:

>It is possible to create a servlet thread in the init() method.  That
>thread sould stay alive and run something every thirty minutes.  The
>issue of pushing information out to the user remins the same.  The
>servlet and the thread cannot do that.  On the other hand, it is
>possible to setup java script on the page to detect 30 minute intervals
>to pull a page from the server.
>It is an awful lot of work for so little a result... It is best just to
>put a java process into cron or task scheduler and have the user run the
>report when they want the info.
> >>> 12-21-2004 14:44 >>>
>Jorge Sopena wrote:
> > Why is bad using own threads inside web application?
> > Aren't all the servlet request actually a thread in Tomcat?
> > I can't find a reason why it's so bad solution.
>I think that comes from J2EE specs. I do not remember is threads just
>forbidden but if you follow specs, you do not know and you do not have
>to know how application server uses threads and controls thread
>behaviour. If portability is issue for your application, it is better
>not use threads.
>  >
> > In that way, you manage to have a single and independent
> >
> > Maybe I don't know some thread behaviour in Tomcat...
> >
>After all, I have use threads in web application with tomcat :) and I
>haven't have any problems or strange thread behaviour. Sometimes whole
>concurrent programming and syncronizing my own threads causes troubles
>but nothing due tomcat.
>Back to original question.
> > wrote:
> > I am using Tomcat4.1.30 version.
> > I have to develop a client application which looks in the database
>every 30
> > minutes,
>ApplicationContextListener + Timer + TimerTask
> > to retrieve the status of an order and send the status to the remote
> > Again waits for the
> > The client's response and insert the repsonse back to the database.
>What is that remote client? Is actually another server and your
>application is client. If so, just add client code for server in
>TimerTask (http-, web service- or whatever client).
>- Jukka -

We have used a cron job using a command-line text-only web browser like 
'links' or 'Lynx' to execute scripts like this at intervals. Much easier 


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Configuration by Glenn Parsons

View raw message